Merge branch 'master' of...

Merge branch 'master' of https://gitlab.discs.ateneo.edu/rajochristiancadorna/widget_placeholdername
parent 1e634e75
......@@ -9,8 +9,7 @@ class WidgetUser(models.Model):
id_num = models.IntegerField()
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):
widgetuser = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
dept_name = 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 .models import WidgetUser
from .models import Department
from . models import WidgetUser
from . models import Department
from django.shortcuts import render
# Create your views here.
def index(request):
display0 = "WIDGET USERS: <br>"
display1 = list(display0)
display2 = Department.objects.all()
finalDisplay = chain(display1,display2)
return HttpResponse(finalDisplay)
widgets = WidgetUser.objects.all()
depts = Department.objects.all()
context ={
'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