html - Preferred way to POST with params from a listing template in Django -


i looking input on preferred way of making post request list template in django. way i'm using doesn't quite seem right me, though works.

let's have table of data model, somemodel, i'm outputting in django gcbv listview.

class somemodellist(listview):     model = somemodel 

in template i'm iterating on list of models , outputting each row in table of data, , want 2 buttons make post perform operation on current row's object.

i can write entire form each operation manually. like:

{% object in object_list %}     {{ object.name }}</br>     <form method="post" action="{{ url 'do_something' {{ object.pk }}"><input type="button" value="do something"/></form></br>     <form method="post" action="{{ url 'do_something_else' {{ object.pk }}"><input type="button" value="do else"/></form></br> {% endfor %} 

it doesn't seem correct writing out these form tags this.

is best way? maybe should have single giant form around whole list , use properties of button? maybe should doing django forms? maybe else entirely?

thanks!


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -