forked from rc/aircox
feat: add error message page; improve admin ui; add missing test files
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
||||
|
||||
@@ -60,6 +61,11 @@ class BaseView(TemplateResponseMixin, ContextMixin):
|
||||
|
||||
return super().get_context_data(**kwargs)
|
||||
|
||||
def dispatch(self, *args, **kwargs):
|
||||
if not self.request.station:
|
||||
return HttpResponseRedirect(reverse("errors-no-station"))
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
|
||||
# FIXME: rename to sth like [Base]?StationAPIView/Mixin
|
||||
class BaseAPIView:
|
||||
|
||||
Reference in New Issue
Block a user