Commit 88a309fc authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

created widgetuser-details.html, updated models.py, views.py, urls.py to...

created widgetuser-details.html, updated models.py, views.py, urls.py to account for new widgetuser details pages
parent 1f6e273e
...@@ -20,4 +20,4 @@ class WidgetUser(models.Model): ...@@ -20,4 +20,4 @@ class WidgetUser(models.Model):
return self.last_name + ' ' + self.first_name return self.last_name + ' ' + self.first_name
def get_absolute_url(self): def get_absolute_url(self):
return reverse("widgetusers:user-details", kwargs={"pk": self.pk}) return reverse("dashboard:widgetuser-details", kwargs={"pk": self.pk})
\ No newline at end of file \ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.last_name }}, {{ object.first_name }} {% endblock %}
{% block content %}
<h1>{{ object.first_name }} {{ object.middle_name }} {{ object.last_name }}</h1>
<h2> {{ object.department }} </h2>
<h2> {{ object.department.home_unit }} </h2>
<form action = "./edit">
<input type = "submit" value = "Edit Widget User">
</form>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import dashboard from .views import dashboard, WidgetUserDetailView
urlpatterns = [ urlpatterns = [
path('', dashboard, name = 'dashboard'), path('', dashboard, name = 'dashboard'),
path('widgetusers/<int:pk>/details', WidgetUserDetailView.as_view(), name = 'widgetuser-details'),
] ]
app_name = "dashboard" app_name = "dashboard"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views.generic.detail import DetailView
from .models import Department, WidgetUser from .models import Department, WidgetUser
...@@ -10,3 +11,7 @@ def dashboard(request): ...@@ -10,3 +11,7 @@ def dashboard(request):
} }
return render(request, 'dashboard/dashboard.html', context) return render(request, 'dashboard/dashboard.html', context)
class WidgetUserDetailView(DetailView):
model = WidgetUser
template_name = 'dashboard/widgetuser-details.html'
\ No newline at end of file
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