Commit 34dd94ea authored by Almira Redoble's avatar Almira Redoble

Updated and implemented view following the specifications

parent a2128669
...@@ -15,7 +15,7 @@ class WidgetUserAdmin(admin.ModelAdmin): ...@@ -15,7 +15,7 @@ class WidgetUserAdmin(admin.ModelAdmin):
fieldsets = [ fieldsets = [
('Name', { ('Name', {
'fields': 'fields':
(('last_name', 'first_name'), 'middle_name', 'department',), (('last_name', 'first_name'), 'middle_name', 'department',),
}), }),
] ]
...@@ -30,7 +30,7 @@ class DepartmentAdmin(admin.ModelAdmin): ...@@ -30,7 +30,7 @@ class DepartmentAdmin(admin.ModelAdmin):
fieldsets = [ fieldsets = [
('Details', { ('Details', {
'fields': 'fields':
(('dept_name', 'home_unit'),), (('dept_name', 'home_unit'),),
}), }),
] ]
......
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import WidgetUser
def index(request): def index(request):
return HttpResponse('Placeholder')
head = "<h1 style='border-bottom:4px solid lightgray;\
padding-bottom:30px;\
font-size:500%;'>\
Welcome to Widget!\
</h1>"
body = "<h2>WIDGET USERS:</h2>"
for user in WidgetUser.objects.all():
body += "<p style='border: 2px solid gray;\
border-radius:5px;\
padding:20px 30px;'>\
{}: {}<br>\
</p>".format(user, user.department)
return_string = "<html>\
<body style = 'font-family:helvetica;\
padding:30px;'>\
{}{}\
</body></html>".format(head, body)
return HttpResponse(return_string)
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