diff --git a/frontend/templates/registration/base.html b/frontend/templates/registration/base.html new file mode 100644 index 0000000..b7b9ca9 --- /dev/null +++ b/frontend/templates/registration/base.html @@ -0,0 +1,33 @@ +{% include "frontend/header.html" %} + + + +
+ + +
+ +
+ +
+
+ +
+ +
+ +{% block content %} +{% endblock %} + +
+
+
+
+ +
+ +
+ +
+ +{% include "frontend/footer.html" %} \ No newline at end of file diff --git a/frontend/templates/registration/login.html b/frontend/templates/registration/login.html index 1127eb3..0db63ec 100644 --- a/frontend/templates/registration/login.html +++ b/frontend/templates/registration/login.html @@ -1,57 +1,32 @@ -{% include "frontend/header.html" %} - - - -
- - -
- -
- -
-
- -
- -
-
-
-

Welcome Back!

-
-
- {% csrf_token %} -
- -
-
- -
- -
-
-
- - -
-
-
-
-
- -
- -
+{% extends "registration/base.html" %} +{% block content %} +
+
+

Welcome Back!

- -{% include "frontend/footer.html" %} \ No newline at end of file +
+ {% csrf_token %} +
+ +
+
+ +
+ +
+
+
+ + +
+{% endblock %} \ No newline at end of file diff --git a/frontend/templates/registration/registration_closed.html b/frontend/templates/registration/registration_closed.html new file mode 100644 index 0000000..e69de29 diff --git a/frontend/templates/registration/registration_form.html b/frontend/templates/registration/registration_form.html new file mode 100644 index 0000000..e5b5dfa --- /dev/null +++ b/frontend/templates/registration/registration_form.html @@ -0,0 +1,32 @@ +{% extends "registration/base.html" %} + +{% block content %} +
+
+

Let's get started!

+
+
+ {% csrf_token %} +
+ +
+
+ +
+
+ +
+ +
+
+ +
+{% endblock %} diff --git a/frontend/urls.py b/frontend/urls.py index abe9797..d2a3b5c 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -1,4 +1,4 @@ -from .views import DashboardView +from .views import DashboardView, UserRegistrationView from django.urls import path, include @@ -6,4 +6,5 @@ app_name = "frontend" urlpatterns = [ path('', DashboardView.as_view(), name="dashboard"), + path('accounts/register/', UserRegistrationView.as_view(), name="register"), ] diff --git a/frontend/views.py b/frontend/views.py index 4e9fbac..be80813 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -1,5 +1,8 @@ -from django.views.generic import TemplateView, ListView, UpdateView, DetailView, CreateView, DeleteView +from django.views.generic import TemplateView, CreateView from django.contrib.auth.mixins import LoginRequiredMixin +from django.contrib.auth.forms import UserCreationForm +from django.contrib.auth import get_user_model, login +from django.urls import reverse_lazy class DashboardView(LoginRequiredMixin, TemplateView): @@ -9,4 +12,18 @@ class DashboardView(LoginRequiredMixin, TemplateView): context = super().get_context_data(**kwargs) context["title"] = "Dashboard" context["subtitle"] = "An overview of everything going on in your Kumify account." - return context \ No newline at end of file + return context + + +class UserRegistrationView(CreateView): + form_class = UserCreationForm + model = get_user_model() + template_name = "registration/registration_form.html" + + def form_valid(self, form): + ret = super().form_valid(form) + login(self.request, self.object) + return ret + + def get_success_url(self): + return reverse_lazy("frontend:dashboard") \ No newline at end of file