diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-20 20:15:03 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-20 20:15:03 +0000 |
commit | b3ba5d7a9758a0e167409757dbe46dfc75bade5c (patch) | |
tree | 0e446d4b5a5f302179ff2fc3fb5792baac53ff80 /ctrack | |
parent | b56df3b59558e790b1e9a7a4aab16fa4c798110c (diff) |
convert our view to CBV
Diffstat (limited to 'ctrack')
-rw-r--r-- | ctrack/organisations/urls.py | 4 | ||||
-rw-r--r-- | ctrack/organisations/views.py | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ctrack/organisations/urls.py b/ctrack/organisations/urls.py index a3b1b9f..c6cc382 100644 --- a/ctrack/organisations/urls.py +++ b/ctrack/organisations/urls.py @@ -1,9 +1,9 @@ from django.urls import path -from ctrack.organisations.views import organisations_detail_view +from ctrack.organisations.views import OrganisationDetailView app_name = "organisations" urlpatterns = [ - path("<str:name>/", view=organisations_detail_view, name="detail") + path("<str:name>/", view=OrganisationDetailView, name="detail") ] diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index 30d00be..92bb134 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -1,2 +1,8 @@ -def organisations_detail_view(request): - pass +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import DetailView + +from .models import Organisation + + +class OrganisationDetailView(LoginRequiredMixin, DetailView): + model = Organisation |