Django practice
Can I simulate a form of behavior type when a user clicks on a simple link?
For example, can I have in views.py
def remove(request, entity_id):
#remove the object with entity_id here
And in HTML
<a href="profile/remove/{{ obj.entity_id }}">
And in urls.py
(r'^app/profile/remove/(?P<entity_id>\d+)', 'app.views.remove')
Or do I need to use a proper HTML form like in the tutorial ?
+2
source to share
1 answer
GET / HEAD requests should not have any harmful side effects (from the HTTP 1.1 spec, 9.1 : "In particular, it has been a convention that the GET and HEAD methods SHOULD NOT have the meaning of taking any action other than retrieving.") That for POST / PUT / DELETE methods.
In addition, Django will not prohibit deleting a row from the database on a GET request if that is what you are asking for.
+4
source to share