From 2817054e7e49309247bcbf62751f6ddaf6b8297b Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sat, 14 Sep 2024 15:53:10 +0200 Subject: [PATCH] feat(dgsi.views): Add a view to create users --- src/dgsi/urls.py | 1 + src/dgsi/views.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dgsi/urls.py b/src/dgsi/urls.py index cc2e0d0..38c0e0c 100644 --- a/src/dgsi/urls.py +++ b/src/dgsi/urls.py @@ -6,4 +6,5 @@ app_name = "dgsi" urlpatterns = [ path("accounts/profile/", views.ProfileView.as_view(), name="dgn-profile"), + path("accounts/create/", views.CreateUserView.as_view(), name="dgn-create_user"), ] diff --git a/src/dgsi/views.py b/src/dgsi/views.py index 75ebf1f..5515f8f 100644 --- a/src/dgsi/views.py +++ b/src/dgsi/views.py @@ -1,6 +1,13 @@ from django.contrib.auth.mixins import LoginRequiredMixin -from django.views.generic import TemplateView +from django.views.generic import CreateView, TemplateView + +from dgsi.mixins import StaffRequiredMixin +from dgsi.models import User class ProfileView(LoginRequiredMixin, TemplateView): template_name = "account/profile.html" + + +class CreateUserView(StaffRequiredMixin, CreateView): + model = User