Posting data from templates to views.py without using forms.

14 views
Skip to first unread message

Surajeet Das

unread,
Jan 1, 2019, 9:46:53 AM1/1/19
to Django users
Well , I want to post data from templates to views.py by clicking a button without using forms. Basically the button should not be of type submit because I don't want the page to be refreshed .I want to view the data from database after the query in the same page. 

pradam

unread,
Jan 1, 2019, 9:58:28 AM1/1/19
to django...@googlegroups.com
Hi Surjeet,

Then you should rely on ajax call or angularjs using ng-click.

On Tue, Jan 1, 2019 at 8:16 PM Surajeet Das <suraj...@gmail.com> wrote:
Well , I want to post data from templates to views.py by clicking a button without using forms. Basically the button should not be of type submit because I don't want the page to be refreshed .I want to view the data from database after the query in the same page. 

--
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...@googlegroups.com.
To post to this group, send email to django...@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/9c195b3e-ab87-4a5a-a82d-ed8c5885477b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pradam

unread,
Jan 1, 2019, 9:58:43 AM1/1/19
to django...@googlegroups.com
Hi Surjeet,

Then you should rely on ajax call or angularjs using ng-click.

On Tue, Jan 1, 2019 at 8:16 PM Surajeet Das <suraj...@gmail.com> wrote:
Well , I want to post data from templates to views.py by clicking a button without using forms. Basically the button should not be of type submit because I don't want the page to be refreshed .I want to view the data from database after the query in the same page. 

--

Osezele Orukpe

unread,
Jan 2, 2019, 5:20:52 AM1/2/19
to Django users
I guess you not using a frontend framework like reactJs or AngularJs. So i would suggest you look into AJAX. this could be done easily using jQuery's ajax function
Reply all
Reply to author
Forward
0 new messages