Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
midterm_OhMyBash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nheo Samson
midterm_OhMyBash
Commits
691c6991
Commit
691c6991
authored
Mar 05, 2023
by
nheoxoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some lines for formatting reasons
parent
18d1d0ae
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
26 deletions
+23
-26
views.py
widget_OhMyBash/announcements/views.py
+8
-8
admin.py
widget_OhMyBash/dashboard/admin.py
+0
-1
models.py
widget_OhMyBash/dashboard/models.py
+5
-1
views.py
widget_OhMyBash/dashboard/views.py
+3
-5
admin.py
widget_OhMyBash/forum/admin.py
+0
-1
models.py
widget_OhMyBash/forum/models.py
+5
-5
urls.py
widget_OhMyBash/forum/urls.py
+1
-1
views.py
widget_OhMyBash/forum/views.py
+1
-4
No files found.
widget_OhMyBash/announcements/views.py
View file @
691c6991
...
...
@@ -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
,
lov
eTally
,
angry
Tally
,
)
return_string
+=
'</ul>'
return_string
+=
'''Like: {}<br>Love: {}
<br>Angry: {}<br><br>'''
.
format
(
lik
eTally
,
love
Tally
,
angryTally
,
)
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
widget_OhMyBash/dashboard/admin.py
View file @
691c6991
from
django.contrib
import
admin
from
.models
import
Department
,
WidgetUser
...
...
widget_OhMyBash/dashboard/models.py
View file @
691c6991
...
...
@@ -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
)
widget_OhMyBash/dashboard/views.py
View file @
691c6991
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
)
widget_OhMyBash/forum/admin.py
View file @
691c6991
from
django.contrib
import
admin
from
.models
import
ForumPost
,
Reply
...
...
widget_OhMyBash/forum/models.py
View file @
691c6991
...
...
@@ -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
,
)
widget_OhMyBash/forum/urls.py
View file @
691c6991
...
...
@@ -6,4 +6,4 @@ urlpatterns = [
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"forum"
\ No newline at end of file
app_name
=
"forum"
widget_OhMyBash/forum/views.py
View file @
691c6991
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment