You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redirect middleware is a very good idea, but it's usage is quite narrow. It would be good to use more generic approach, with richer exception hierarchy, which would allow to handle other response types.
Sample use case:
you use CBV
you check a condition in .get_context(), which is important to any furtner processing in the view,
condition is not met and all processing should be halted, client should receive some 4xx response
without such infrastructure, get_context should return dictionary, which should be processed by view, which should check the dict and return error response.
with such infrastructure you can raise proper exception and handle it the middleware whithout boilerplate code in the view.
The text was updated successfully, but these errors were encountered:
Redirect middleware is a very good idea, but it's usage is quite narrow. It would be good to use more generic approach, with richer exception hierarchy, which would allow to handle other response types.
Sample use case:
The text was updated successfully, but these errors were encountered: