if request.method not in ('POST', 'PUT', 'DELETE', 'PATCH'):
...
at the top of every method (or use a decorator), but it'd definitely be nice if this were part of the url dispatcher. if request.method not in ('POST', 'PUT', 'DELETE', 'PATCH'):
...
at the top of every method (or use a decorator), but it'd definitely be nice if this were part of the url dispatcher.Finding rails issues and then saying "they kinda sorta apply to Django" isn't as interesting as finding real Django issues.
To yummyfajitas - your message is 50% trolling. Will you allow me to troll a little bit? I used django and scrapy few years ago and despite the fact it was better than PHP I would not even dare to compare it with Rails. Rails is that superior I don't even have words to explain it :D Conclusion: I'm not interested in Django and its bug because I love rails and wanna make it more secure anyways. Sorry, but Django is way less convinient to use. Security is another story though.
Also, if you ever manage to put into words why you prefer Rails, I'd love to read it. Django and rails seem pretty similar to me, but I didn't put much effort into learning rails. But maybe I'm just experiencing the blub paradox.
It was a problem with the older function based views, and there was a lot of boilerplate to ensure the correct HTTP verb was being used.
from django.views.generic.base import View
from django.http import HttpResponse
class MyView(View):
def get(self, request):
return HttpResponse("Get request")
def post(self, request):
return HttpResponse("Post Request")
The functionality to make this "just work" (dispatch based on method) is built into django.views.generic.base.View.dispatch.