1

I am working on a project which sends data to django server using POST request (not through web browser) and updates data on models.

My templates just runs through all the data in models and print it in a table.

The problem here is that I've to manually refresh my page to get the updated data. I want my page to auto-update the data entered into models. I'm very new to django, so is there a way to achieve this? (I'll post the codes if needed)

Parth Jeet
  • 129
  • 2
  • 15
  • 1
    Django is build on Python, which is a *server* language. If you want to refresh data on the page without reloading - u have to use JavaScript, and send AJAX request to the Django-app. – Chiefir May 07 '18 at 15:56
  • @Chiefir Thanks for the comment. Do you mind guiding me to a resource which explains this concept. I'm very new to the area backend development. Thanks again :) – Parth Jeet May 07 '18 at 15:59
  • You can try start from here - https://simpleisbetterthancomplex.com/tutorial/2016/08/29/how-to-work-with-ajax-request-with-django.html, very useful blog for Django beginners :) – Chiefir May 07 '18 at 16:00
  • also read this question: https://stackoverflow.com/q/20306981/8495108 Much simpler for getting a concept. – Chiefir May 07 '18 at 16:07
  • the other approach instead of AJAX could be using `asyncio` see chat example for an inspiration https://gist.github.com/gregvish/7665915 – andilabs May 07 '18 at 22:22

0 Answers0