Generic View http_method bug
|Reported by:||pyrou||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In generic views, you can find some http_method alias, just like in DeleteView (inherited from DeletionMixin)
post = delete
but if you override the orginal "delete" method in your own view :
class myDeleteView(DeleteView): def delete(self, request, *args, **kwargs): print "some console log" return super(DeleteView, self).delete(self, request, *args, **kwargs)
your log is never printed, because your browser will use POST method, and so the original delete method is called instead of the overriden one.
Adding everytime the alias
post = delete is not "DRY-ful"..
This way seems to be more "correct" for every alias:
def post(self, *args, **kwargs): return self.delete(*args, **kwargs)