Style: Changed format of homepage to ordered list of widget users

parent bb9901c5
<p>
<h2>WIDGET USERS:</h2>
{% if Departments %}
<ol>
{% for department in Departments %}
<li>
<a href="/homepage/{{department.id_num}}/">
{{department.widgetuser.last_name}},
{{department.widgetuser.first_name}}
{{department.widgetuser.middle_name}}
</a>
</li>
{% endfor %}
</ol>
{% else %}
<p>No widget users registered.</p>
{% endif %}
</p>
\ No newline at end of file
......@@ -4,4 +4,5 @@ from . import views
urlpatterns = [
path('', views.index, name='index')
path("<int:user_id>/", users/<user_id>/details/, name="detail")
]
\ No newline at end of file
from django.http import HttpResponse
#from django.template import loader
from django.shortcuts import render
from .models import Department
def index(request):
Departments = Department.objects.all()
return render(request, 'widgetusers_listings.html', {'Departments': Departments})
#Departments = Department.objects.all()
Departments = Department.objects.order_by("last_name")
#template = loader.get_tempate("widgetusers_orderedlist.html")
context = {
"Departments": Departments
}
return render(request, "widgetusers_orderedlist.html", context)
#render HttpResponse(template.render(context, request))
#output = ", ".join([a.article_title for a in article_list])
#return render(request, 'widgetusers_listings.html', {'Departments': Departments})
# def detail(request, user_id):
# try:
# Departments = Department.objects.get(pk=department_widgetuser_id_num)
# except Department.DoesNotExist:
# raise Http404("User does not exist!")
# return render(request, "homepage/details.html", {"Departments": Department})
return HttpResponse("This is Widget User # %s." % user_id)
#def reaction(request, article_id)
#response = "These are the reactions to article #%s"
#return HttpsResponse(response % article_id)
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