Reputation: 5618
Can I simulate form like behaviour 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 the HTML
<a href="profile/remove/{{ obj.entity_id }}">
And in the urls.py
(r'^app/profile/remove/(?P<entity_id>\d+)', 'app.views.remove')
Or do I have to use a proper HTML form like in the tutorial?
Upvotes: 2
Views: 172
Reputation: 129764
GET/HEAD requests should not have any harmful side-effects (from HTTP 1.1 spec, 9.1: "In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval."), that's what POST/PUT/DELETE methods are for.
Other than that - Django won't forbid deleting a row from DB on GET request, if that's what you ask.
Upvotes: 4