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(
likeTally,
loveTally,
angryTally,
)
return_string += '</ul>'
return_string += '''Like: {}<br>Love: {}
<br>Angry: {}<br><br>'''.format(
likeTally,
loveTally,
angryTally,
)
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
......
......@@ -5,7 +5,7 @@ class ForumPost(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
author = models.ForeignKey(
'dashboard.WidgetUser',
'dashboard.WidgetUser',
on_delete=models.CASCADE,
related_name='forumpost_author'
)
......@@ -23,7 +23,7 @@ class ForumPost(models.Model):
class Reply(models.Model):
body = models.TextField()
author = models.ForeignKey(
'dashboard.WidgetUser',
'dashboard.WidgetUser',
on_delete=models.CASCADE,
related_name='reply_author'
)
......@@ -36,7 +36,7 @@ class Reply(models.Model):
def __str__(self):
return 'Reply by {} posted {}: {}'.format(
self.author,
self.author,
self.pub_datetime,
self.body
)
\ No newline at end of file
self.body,
)
......@@ -6,4 +6,4 @@ urlpatterns = [
path('', index, name='index'),
]
app_name = "forum"
\ No newline at end of file
app_name = "forum"
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():
......@@ -41,4 +38,4 @@ def index(request):
continue
html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string)
\ No newline at end of file
return HttpResponse(html_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