diff --git a/admin/urls.py b/admin/urls.py index 9a26cbf..56daa08 100644 --- a/admin/urls.py +++ b/admin/urls.py @@ -10,4 +10,5 @@ urlpatterns = [ path("users/edit/", views.EditUserView.as_view(), name="edit_user"), path("users/delete/", views.DeleteUserView.as_view(), name="delete_user"), path("institution/", views.InstitutionView.as_view(), name="institution"), + path("states/", views.StatesPanelView.as_view(), name="states"), ] diff --git a/admin/views.py b/admin/views.py index 9ce25c7..030ebb0 100644 --- a/admin/views.py +++ b/admin/views.py @@ -11,6 +11,7 @@ from django.views.generic.edit import ( from dashboard.mixins import DashboardView, Http403 from user.models import User, Institution from admin.email import NotifyActivateUserByEmail +from action.models import State, StateDefinition class AdminView(DashboardView): @@ -124,3 +125,17 @@ class InstitutionView(AdminView, UpdateView): self.object = self.request.user.institution kwargs = super().get_form_kwargs() return kwargs + +class StatesPanelView(AdminView, TemplateView): + template_name = "states_panel.html" + title = _("States") + breadcrumb = _("admin / States") + " /" + + def get_context_data(self, **kwargs): + + context = super().get_context_data(**kwargs) + context.update({ + "states": State.objects.filter(institution=self.request.user.institution), + "state_definitions" : StateDefinition.objects.filter(institution=self.request.user.institution).order_by('order') + }) + return context diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 40e6658..004e805 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -96,6 +96,11 @@ {% trans 'Users' %} + {% endif %}