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
Show 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
...
@@ -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: {}
<br>Angry: {}<br><br>'''
.
format
(
likeTally
,
likeTally
,
loveTally
,
loveTally
,
angryTally
,
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
)
widget_OhMyBash/dashboard/admin.py
View file @
691c6991
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Department
,
WidgetUser
from
.models
import
Department
,
WidgetUser
...
...
widget_OhMyBash/dashboard/models.py
View file @
691c6991
...
@@ -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
)
widget_OhMyBash/dashboard/views.py
View file @
691c6991
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
)
widget_OhMyBash/forum/admin.py
View file @
691c6991
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
ForumPost
,
Reply
from
.models
import
ForumPost
,
Reply
...
...
widget_OhMyBash/forum/models.py
View file @
691c6991
...
@@ -38,5 +38,5 @@ class Reply(models.Model):
...
@@ -38,5 +38,5 @@ class Reply(models.Model):
return
'Reply by {} posted {}: {}'
.
format
(
return
'Reply by {} posted {}: {}'
.
format
(
self
.
author
,
self
.
author
,
self
.
pub_datetime
,
self
.
pub_datetime
,
self
.
body
self
.
body
,
)
)
widget_OhMyBash/forum/urls.py
View file @
691c6991
widget_OhMyBash/forum/views.py
View file @
691c6991
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
():
...
...
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