From a8ec3c573340cbf4ee7f4fc0690cc7ad7db1dd60 Mon Sep 17 00:00:00 2001 From: Noah Kim Date: Thu, 31 Aug 2017 13:34:37 -0400 Subject: [PATCH] Create hooks for #13 --- groups/templates/groups/student/type.html | 7 ------- home/site.py | 1 + home/templates/home/student/profile.html | 5 +++++ home/templates/home/student/sidebar.html | 2 +- home/views/__init__.py | 6 ++++++ home/views/student.py | 9 +++++++-- 6 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 home/templates/home/student/profile.html diff --git a/groups/templates/groups/student/type.html b/groups/templates/groups/student/type.html index 8b95ec2..9de4f38 100644 --- a/groups/templates/groups/student/type.html +++ b/groups/templates/groups/student/type.html @@ -18,11 +18,4 @@

Academic

request for this type of group.
Create →

-

Administrative

-

Administrative groups are for management roles and organizations such as the sysops. It is not possible to submit a -request for this type of group.
-Create →

- -

External

- {% endblock %} diff --git a/home/site.py b/home/site.py index 545528c..ba28289 100644 --- a/home/site.py +++ b/home/site.py @@ -13,5 +13,6 @@ url("^news/$", views.IndexView.as_view(), name="news"), url("^courses/$", views.IndexView.as_view(), name="courses"), url("^account/$", views.IndexView.as_view(), name="account"), + url("^profile/$", views.ProfileView.as_view(), name="profile"), ] diff --git a/home/templates/home/student/profile.html b/home/templates/home/student/profile.html new file mode 100644 index 0000000..a082928 --- /dev/null +++ b/home/templates/home/student/profile.html @@ -0,0 +1,5 @@ +{% extends "base/base.html" %} + +{% block content %} + +{% endblock %} diff --git a/home/templates/home/student/sidebar.html b/home/templates/home/student/sidebar.html index a9c2f67..ffde166 100644 --- a/home/templates/home/student/sidebar.html +++ b/home/templates/home/student/sidebar.html @@ -10,7 +10,7 @@ Add... {% endif %}
Account
-Profile +Profile Applications ✓ Settings Logout ✓ diff --git a/home/views/__init__.py b/home/views/__init__.py index a8eee28..2304102 100644 --- a/home/views/__init__.py +++ b/home/views/__init__.py @@ -54,3 +54,9 @@ class IndexView(LoginRequiredMixin, ProfileBasedViewDispatcher): """View the index page.""" lookup = {models.UserProfile.STUDENT: student.index} + + +class ProfileView(LoginRequiredMixin, ProfileBasedViewDispatcher): + """View the user profile page.""" + + lookup = {models.UserProfile.STUDENT: student.profile} diff --git a/home/views/student.py b/home/views/student.py index 6534b60..e374864 100644 --- a/home/views/student.py +++ b/home/views/student.py @@ -7,5 +7,10 @@ def index(request, *args, **kwargs): """The index view for students.""" - if request.user.profile.type == models.UserProfile.STUDENT: - return render(request, "home/student/index.html") + return render(request, "home/student/index.html") + + +def profile(request, *args, **kwargs): + """View the student profile.""" + + return render(request, "home/student/profile.html")