Commit 691c6991 authored by nheoxoz's avatar nheoxoz

fixed some lines for formatting reasons

parent 18d1d0ae
......@@ -3,9 +3,9 @@ from .models import Announcement, Reaction
def index(request):
return_string = "<p>Widget's Announcement Board</p>Announcements:<ul style='list-style: none; padding: 0; margin: 0;'>"
return_string = "<p>Widget's Announcement Board</p>Announcements:<br>"
for a in Announcement.objects.all():
return_string += '''<li>{} by {} {} published {}</li>{}<br>'''.format(
return_string += '''{} by {} {} published {}{}<br>'''.format(
a.title,
a.author.first_name,
a.author.last_name,
......@@ -22,11 +22,11 @@ def index(request):
loveTally += r.tally
if r.name == "ANGRY" and r.announcement == a:
angryTally += r.tally
return_string += '''Like: {}<br>Love: {}<br>Angry: {}<br><br>'''.format(
return_string += '''Like: {}<br>Love: {}
<br>Angry: {}<br><br>'''.format(
likeTally,
loveTally,
angryTally,
)
return_string += '</ul>'
html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string)
from django.contrib import admin
from .models import Department, WidgetUser
......
......@@ -16,4 +16,8 @@ class WidgetUser(models.Model):
department = models.ForeignKey(Department, on_delete=models.CASCADE)
def __str__(self):
return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
return '{}, {} {}'.format(
self.last_name,
self.first_name,
self.middle_name
)
from django.shortcuts import HttpResponse
from .models import Department, WidgetUser
from .models import WidgetUser
def index(request):
return_string = '<p>Welcome to Widget!</p>WIDGET USERS:<ul style="list-style: none; padding: 0; margin: 0;">'
return_string = '<p>Welcome to Widget!</p>WIDGET USERS:<br>'
for user in WidgetUser.objects.all():
return_string += '<li>{}: {}</li>'.format(user, user.department)
return_string += '</ul>'
return_string += '{}: {}<br>'.format(user, user.department)
html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string)
from django.contrib import admin
from .models import ForumPost, Reply
......
......@@ -38,5 +38,5 @@ class Reply(models.Model):
return 'Reply by {} posted {}: {}'.format(
self.author,
self.pub_datetime,
self.body
self.body,
)
from django.shortcuts import render
from django.http import HttpResponse
from .models import ForumPost, Reply
def index(request):
return_string = "<p>Widget's Forum</p>Forum Posts:"
for post in ForumPost.objects.all():
counter = 0
for reply in Reply.objects.all():
......
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