added assignments.html template

parent 48ec8443
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Assignments:</h1>
{% for assignment in assignments %}
Assignment Name: {{assignment.name}} <br>
Description: {{assignment.description}} <br>
Perfect Score: {{assignment.max_points}} <br>
Passing Score: {{assignment.passing_score}} <br>
Course/Section: {{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}
<br><br>
{% endfor %}
</body>
</html>
...@@ -9,8 +9,7 @@ class WidgetUser(models.Model): ...@@ -9,8 +9,7 @@ class WidgetUser(models.Model):
id_num = models.IntegerField() id_num = models.IntegerField()
email = models.EmailField(max_length=100) email = models.EmailField(max_length=100)
def __str__(self):
return self.last_name + ", " + self.first_name + " " + self.middle_name + ": " + str(self.id_num) + ", " + self.email + "<br>"
...@@ -18,6 +17,3 @@ class Department(models.Model): ...@@ -18,6 +17,3 @@ class Department(models.Model):
widgetuser = models.ForeignKey(WidgetUser, on_delete=models.CASCADE) widgetuser = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
dept_name = models.CharField(max_length=50) dept_name = models.CharField(max_length=50)
home_unit = models.CharField(max_length=50) home_unit = models.CharField(max_length=50)
def __str__(self):
return self.widgetuser.last_name + ", " + self.widgetuser.first_name + " " + self.widgetuser.middle_name + ": " + str(self.widgetuser.id_num) + ", " + self.widgetuser.email + ", " + self.dept_name + ", " + self.home_unit + "<br>"
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<body>
<h1>WIDGET USERS: </h1>
{% for Depts in Depts %}
<h4>{{Depts.widgetuser.last_name}}, {{Depts.widgetuser.first_name}} {{Depts.widgetuser.middle_name}}: {{Depts.widgetuser.id_num}}, {{Depts.widgetuser.email}}, {{ Depts.dept_name }}, {{ Depts.home_unit }}</h4>
{% endfor %}
</body>
</html>
\ No newline at end of file
from itertools import chain
from django.http import HttpResponse from django.http import HttpResponse
from .models import WidgetUser from . models import WidgetUser
from .models import Department from . models import Department
from django.shortcuts import render
# Create your views here. # Create your views here.
def index(request): def index(request):
display0 = "WIDGET USERS: <br>" widgets = WidgetUser.objects.all()
display1 = list(display0) depts = Department.objects.all()
display2 = Department.objects.all()
finalDisplay = chain(display1,display2) context ={
return HttpResponse(finalDisplay) 'Widgets':widgets,
'Depts':depts
}
return render(request, "view.html", context)
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