Thanks, your solution was very helpful to me.
In your example, I received 500 errors if a method does not allow
AssertionError: .accepted_renderer not set on Response
I replaced the Response method on the parent method call, where I got normal behaviour and error 405.
def dispatch(self, request, *args, **kwargs):
if not hasattr(self, 'VIEWS_BY_METHOD'):
raise Exception('VIEWS_BY_METHOD static dictionary variable must be defined on a ManageView class!')
if request.method in self.VIEWS_BY_METHOD:
return self.VIEWS_BY_METHOD[request.method]()(request, *args, **kwargs)
return super().dispatch(request, *args, **kwargs)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.