Skip to content

Commit

Permalink
Create hooks for #13
Browse files Browse the repository at this point in the history
  • Loading branch information
noahbkim committed Aug 31, 2017
1 parent 9290f4e commit a8ec3c5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
7 changes: 0 additions & 7 deletions groups/templates/groups/student/type.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,4 @@ <h2>Academic</h2>
request for this type of group.<br>
<a href="{% url "groups:create" typeof="academic" %}">Create &rightarrow;</a></p>

<h2>Administrative</h2>
<p>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.<br>
<a href="{% url "groups:create" typeof="administrative" %}">Create &rightarrow;</a></p>

<h2>External</h2>

{% endblock %}
1 change: 1 addition & 0 deletions home/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),

]
5 changes: 5 additions & 0 deletions home/templates/home/student/profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "base/base.html" %}

{% block content %}

{% endblock %}
2 changes: 1 addition & 1 deletion home/templates/home/student/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a class="item" href="{% url "groups:list" %}">Add...</a>
{% endif %}
<div class="section">Account</div>
<a class="item">Profile</a>
<a class="item" href="{% url "home:profile" %}">Profile</a>
<a class="item" href="{% url "oauth2_provider:list" %}">Applications &#x2713;</a>
<a class="item">Settings</a>
<a class="item" href="{% url "home:logout" %}">Logout &#x2713;</a>
6 changes: 6 additions & 0 deletions home/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
9 changes: 7 additions & 2 deletions home/views/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit a8ec3c5

Please sign in to comment.