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 ...@@ -3,9 +3,9 @@ from .models import Announcement, Reaction
def index(request): 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(): for a in Announcement.objects.all():
return_string += '''<li>{} by {} {} published {}</li>{}<br>'''.format( return_string += '''{} by {} {} published {}{}<br>'''.format(
a.title, a.title,
a.author.first_name, a.author.first_name,
a.author.last_name, a.author.last_name,
...@@ -22,11 +22,11 @@ def index(request): ...@@ -22,11 +22,11 @@ def index(request):
loveTally += r.tally loveTally += r.tally
if r.name == "ANGRY" and r.announcement == a: if r.name == "ANGRY" and r.announcement == a:
angryTally += r.tally angryTally += r.tally
return_string += '''Like: {}<br>Love: {}<br>Angry: {}<br><br>'''.format( return_string += '''Like: {}<br>Love: {}
likeTally, <br>Angry: {}<br><br>'''.format(
loveTally, likeTally,
angryTally, loveTally,
) angryTally,
return_string += '</ul>' )
html_string = '<html><body>{}</body></html>'.format(return_string) html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string) return HttpResponse(html_string)
from django.contrib import admin from django.contrib import admin
from .models import Department, WidgetUser from .models import Department, WidgetUser
......
...@@ -16,4 +16,8 @@ class WidgetUser(models.Model): ...@@ -16,4 +16,8 @@ class WidgetUser(models.Model):
department = models.ForeignKey(Department, on_delete=models.CASCADE) department = models.ForeignKey(Department, on_delete=models.CASCADE)
def __str__(self): 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 django.shortcuts import HttpResponse
from .models import WidgetUser
from .models import Department, WidgetUser
def index(request): 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(): for user in WidgetUser.objects.all():
return_string += '<li>{}: {}</li>'.format(user, user.department) return_string += '{}: {}<br>'.format(user, user.department)
return_string += '</ul>'
html_string = '<html><body>{}</body></html>'.format(return_string) html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string) return HttpResponse(html_string)
from django.contrib import admin from django.contrib import admin
from .models import ForumPost, Reply from .models import ForumPost, Reply
......
...@@ -5,7 +5,7 @@ class ForumPost(models.Model): ...@@ -5,7 +5,7 @@ class ForumPost(models.Model):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
body = models.TextField() body = models.TextField()
author = models.ForeignKey( author = models.ForeignKey(
'dashboard.WidgetUser', 'dashboard.WidgetUser',
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='forumpost_author' related_name='forumpost_author'
) )
...@@ -23,7 +23,7 @@ class ForumPost(models.Model): ...@@ -23,7 +23,7 @@ class ForumPost(models.Model):
class Reply(models.Model): class Reply(models.Model):
body = models.TextField() body = models.TextField()
author = models.ForeignKey( author = models.ForeignKey(
'dashboard.WidgetUser', 'dashboard.WidgetUser',
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='reply_author' related_name='reply_author'
) )
...@@ -36,7 +36,7 @@ class Reply(models.Model): ...@@ -36,7 +36,7 @@ class Reply(models.Model):
def __str__(self): def __str__(self):
return 'Reply by {} posted {}: {}'.format( return 'Reply by {} posted {}: {}'.format(
self.author, self.author,
self.pub_datetime, self.pub_datetime,
self.body self.body,
) )
\ No newline at end of file
...@@ -6,4 +6,4 @@ urlpatterns = [ ...@@ -6,4 +6,4 @@ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
] ]
app_name = "forum" app_name = "forum"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import ForumPost, Reply from .models import ForumPost, Reply
def index(request): def index(request):
return_string = "<p>Widget's Forum</p>Forum Posts:" return_string = "<p>Widget's Forum</p>Forum Posts:"
for post in ForumPost.objects.all(): for post in ForumPost.objects.all():
counter = 0 counter = 0
for reply in Reply.objects.all(): for reply in Reply.objects.all():
...@@ -41,4 +38,4 @@ def index(request): ...@@ -41,4 +38,4 @@ def index(request):
continue continue
html_string = '<html><body>{}</body></html>'.format(return_string) html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string) return HttpResponse(html_string)
\ No newline at end of file
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