Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
32a8afd7
Commit
32a8afd7
authored
Apr 04, 2022
by
Angelico Ruiz T. Teaño
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed HttpResponse format for views of each app
parent
e1c09fa9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
24 deletions
+13
-24
views.py
widget_alipins/announcements/views.py
+4
-6
views.py
widget_alipins/assignments/views.py
+3
-7
views.py
widget_alipins/forum/views.py
+3
-5
views.py
widget_alipins/homepage/views.py
+3
-6
No files found.
widget_alipins/announcements/views.py
View file @
32a8afd7
from
django.http
import
HttpResponse
from
.models
import
Announcement
,
Reaction
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
display_announcementboard
(
Announcement
.
objects
.
all
()))
def
display_announcementboard
(
announcement_data
):
display_output
=
"<u><b>ANNOUNCEMENTS</u></b>: <br>"
for
object
in
announcement_data
:
for
object
in
Announcement
.
objects
.
all
():
display_output
+=
'''
<b>{title} by {first_name} {last_name}</b> dated {date}:<br>
{body}<br>
...
...
@@ -23,5 +22,4 @@ def display_announcementboard(announcement_data):
love_tally
=
Reaction
.
objects
.
filter
(
announcement_id
=
object
.
id
)
.
filter
(
reaction_name
=
"Love"
)
.
first
()
.
tally
,
angry_tally
=
Reaction
.
objects
.
filter
(
announcement_id
=
object
.
id
)
.
filter
(
reaction_name
=
"Angry"
)
.
first
()
.
tally
)
return
display_output
return
HttpResponse
(
display_output
)
widget_alipins/assignments/views.py
View file @
32a8afd7
from
django.http
import
HttpResponse
from
.models
import
Assignment
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
display_assignments
(
Assignment
.
objects
.
all
()))
def
display_assignments
(
data_set_assignment
):
display_output
=
"<u><b>ASSIGNMENTS</u></b>: <br>"
for
object
in
data_set_assignment
:
for
object
in
Assignment
.
objects
.
all
()
:
display_output
+=
'''
Assignment Name: <b>{name}</b><br>
Description: {description}<br>
...
...
@@ -24,4 +20,4 @@ def display_assignments(data_set_assignment):
course_title
=
object
.
course
.
course_title
,
section
=
object
.
course
.
section
)
return
display_output
\ No newline at end of file
return
HttpResponse
(
display_output
)
widget_alipins/forum/views.py
View file @
32a8afd7
...
...
@@ -3,12 +3,9 @@ from .models import Post, Reply
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
display_forum
(
Post
.
objects
.
all
()))
def
display_forum
(
post_data
):
display_output
=
"<u><b>FORUM POSTS</u></b>:<br>"
for
post
in
post_data
:
for
post
in
Post
.
objects
.
all
()
:
display_output
+=
f
"<b>{post.post_title} by {post.author.first_name} {post.author.last_name}</b> dated {str(post.pub_date)}:
\
<br>{post.post_body}"
replies
=
Reply
.
objects
.
filter
(
post
=
post
)
...
...
@@ -17,5 +14,6 @@ def display_forum(post_data):
<br>{reply.reply_body}"
display_output
+=
"<br><br>"
return
display_output
return
HttpResponse
(
display_output
)
\ No newline at end of file
widget_alipins/homepage/views.py
View file @
32a8afd7
...
...
@@ -3,12 +3,9 @@ from django.http import HttpResponse
from
.models
import
WidgetUser
def
index
(
request
):
return
HttpResponse
(
display_users
(
WidgetUser
.
objects
.
all
()))
def
display_users
(
data_list
):
display_output
=
"<u><b>WIDGET USERS</u></b>: <br>"
for
objects
in
data_list
:
for
objects
in
WidgetUser
.
objects
.
all
()
:
display_output
+=
'''
<b>{last_name}, {first_name} {middle_name}</b>: {id}, {email}, {dept}, {home}<br>
'''
.
format
(
last_name
=
objects
.
last_name
,
...
...
@@ -19,4 +16,4 @@ def display_users(data_list):
dept
=
objects
.
department
.
dept_name
,
home
=
objects
.
department
.
home_unit
)
return
display_output
\ No newline at end of file
return
HttpResponse
(
display_output
)
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