Commit e7a413b3 authored by Franco Velasco's avatar Franco Velasco

Merge branch 'velasco/homepage' into 'master'

Fixed urls pointing to user

See merge request !17
parents af702936 34d38102
...@@ -30,9 +30,6 @@ class WidgetUser(models.Model): ...@@ -30,9 +30,6 @@ class WidgetUser(models.Model):
return f"""{self.last_name}, {self.first_name} {self.middle_name}: return f"""{self.last_name}, {self.first_name} {self.middle_name}:
{self.id_num}, {self.email}, {self.department}""" {self.id_num}, {self.email}, {self.department}"""
def get_absolute_url(self):
return f"users/{self.id_num}/details"
def get_name(self) -> str: def get_name(self) -> str:
return f"{self.last_name}, {self.first_name} {self.middle_name}" return f"{self.last_name}, {self.first_name} {self.middle_name}"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<h3> {{ counter }}. {{ user.get_name }} </h3> <h3> {{ counter }}. {{ user.get_name }} </h3>
<div class="user-links"> <div class="user-links">
<span> {{ user.id_num }} </span> <span> {{ user.id_num }} </span>
<a href="{{ user.get_absolute_url }}"> View Profile </a> <a href="/users/{{ user.id_num }}/details"> View Profile </a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -3,7 +3,6 @@ from .views import HomePageView, UserPageView ...@@ -3,7 +3,6 @@ from .views import HomePageView, UserPageView
urlpatterns = [ urlpatterns = [
path('', HomePageView.as_view(), name='index'), path('', HomePageView.as_view(), name='index'),
path('users/<int:user_id>/details', UserPageView.as_view(), name='user-details')
] ]
app_name = "Homepage" app_name = "Homepage"
\ No newline at end of file
...@@ -18,12 +18,14 @@ from django.urls import path, include ...@@ -18,12 +18,14 @@ from django.urls import path, include
import Announcements.views as Announcements_views import Announcements.views as Announcements_views
import Forum.views as Forum_views import Forum.views as Forum_views
from Assignments.views import AssignmentDetailView from Assignments.views import AssignmentDetailView
from Homepage.views import UserPageView
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('forum/', include('Forum.urls', namespace='Forum')), path('forum/', include('Forum.urls', namespace='Forum')),
path('posts/<int:post_id>/details/', Forum_views.details, name='post_details'), path('posts/<int:post_id>/details/', Forum_views.details, name='post_details'),
path('homepage/', include('Homepage.urls', namespace="Homepage")), path('homepage/', include('Homepage.urls', namespace="Homepage")),
path('users/<int:user_id>/details', UserPageView.as_view(), name='user-details'),
path('announcements/', include('Announcements.urls', namespace="Announcements")), path('announcements/', include('Announcements.urls', namespace="Announcements")),
path('announcements/<int:announcement_id>/details', Announcements_views.details, name='announcement_details'), path('announcements/<int:announcement_id>/details', Announcements_views.details, name='announcement_details'),
path('assignments/', include('Assignments.urls', namespace="Assignments")), path('assignments/', include('Assignments.urls', namespace="Assignments")),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment