Shivendra, If you want to have an effect at the server without leaving the current page, you'll find that Django itself does not do that. Instead, you'll have to do one of: - Use _javascript_ in the page to make an Ajax or WebSockets call to the server (handled by a Django view if you like) to tell it to update the DB, or... - Use Django "Channels" to communicate with the server via WebSockets. If you find yourself doing lots of Ajax calls to the server, you may want to check out the Django REST Framework which makes it easier to write Django views that accept Ajax calls and return JSON data instead of returning full HTML pages. Or, you can accomplish a similar effect via plain vanilla Django, if you allow the button click to trigger a regular form submit, and have the response look exactly like the original page, so it's not obvious to the user that a full page request was done. But, it sounds like you've already decided you don't want to do that. --Fred
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service! Open Source: Without walls and fences, we need no Windows or Gates. On 5/28/17 9:25 PM, shivendra bind
wrote:
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8a2e862-8622-b5d5-9389-d98367c6fc8b%40bristle.com. For more options, visit https://groups.google.com/d/optout. |
- Class based view without rendering form shivendra bind
- Re: Class based view without rendering form Fred Stluka