diff options
Diffstat (limited to 'ctrack/organisations/views.py')
-rw-r--r-- | ctrack/organisations/views.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index b085e3b..0902e57 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -1,12 +1,21 @@ from typing import Any +from typing import Dict from django.contrib.auth.mixins import LoginRequiredMixin -from django.views.generic import DetailView -from typing import Dict +from django.views.generic import DetailView, ListView from .models import Organisation +class OrganisationListView(LoginRequiredMixin, ListView): + model = Organisation + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["organisation_list"] = Organisation.objects.all().order_by("name") + return context + + class OrganisationDetailView(LoginRequiredMixin, DetailView): model = Organisation |