i have create one Django app in which i want to pass data to html template which is comming from my database (table's last entered user name ) and show it html page but user name can automatically change to new one without refreshing page
Asked
Active
Viewed 78 times
0
-
1What's the use case? Does the user logout or switch profiles? – Reez0 Sep 16 '19 at 15:47
-
You could trigger an ajax call by the JS window.setTimeout function. – ger.s.brett Sep 16 '19 at 16:18
-
@Reez0 no no i create a html page where visitor enter there name and this name display on another page , actually i am learning Django now – TSOP 1732 Sep 16 '19 at 16:55
-
@ger.s.brett but how i render data when i already extract it from database and then send to template – TSOP 1732 Sep 16 '19 at 16:56
1 Answers
0
I would query the latest username using something like this:
username = Username.objects.order_by('-created_at').first()
Then you can dynamically update the page by reloading it using jQuery. More info on that here

joshlsullivan
- 1,375
- 2
- 14
- 21
-
Take a look at these jQuery examples - [https://api.jquery.com/category/manipulation/dom-insertion-inside/](https://api.jquery.com/category/manipulation/dom-insertion-inside/) – joshlsullivan Sep 17 '19 at 17:08