Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_robo_mommy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Raul Jarod Conanan
midterm_robo_mommy
Commits
58770713
Commit
58770713
authored
Mar 06, 2023
by
RJC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed announcement view
parent
ef1a5049
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
views.py
widget_robo_mommy/announcements/views.py
+7
-6
No files found.
widget_robo_mommy/announcements/views.py
View file @
58770713
...
@@ -6,7 +6,7 @@ from django.utils import timezone
...
@@ -6,7 +6,7 @@ from django.utils import timezone
def
convert_to_localtime
(
utctime
):
def
convert_to_localtime
(
utctime
):
format
=
'
%
d/
%
m/
%
Y
%
H:
%
M
'
format
=
'
%
d/
%
m/
%
Y
%
I:
%
M
%
p
'
utc
=
utctime
.
replace
(
tzinfo
=
pytz
.
UTC
)
utc
=
utctime
.
replace
(
tzinfo
=
pytz
.
UTC
)
localtz
=
utc
.
astimezone
(
timezone
.
get_current_timezone
())
localtz
=
utc
.
astimezone
(
timezone
.
get_current_timezone
())
return
localtz
.
strftime
(
format
)
return
localtz
.
strftime
(
format
)
...
@@ -19,12 +19,13 @@ def index(request):
...
@@ -19,12 +19,13 @@ def index(request):
html_string_2
=
""
html_string_2
=
""
for
announced
in
Announcement
.
objects
.
all
():
for
announced
in
Announcement
.
objects
.
all
():
html_string_2
+=
"{} by {} {} published {}
<br />:
\
html_string_2
+=
"{} by {} {} published {}
:<br />
\
{}"
.
format
(
announced
.
title
,
announced
.
author
.
first_name
,
{}
<br/>
"
.
format
(
announced
.
title
,
announced
.
author
.
first_name
,
announced
.
author
.
last_name
,
announced
.
author
.
last_name
,
convert_to_localtime
(
announced
.
pub_datetime
),
announced
.
body
)
convert_to_localtime
(
announced
.
pub_datetime
),
announced
.
body
)
for
reacts
in
announced
.
reaction
.
all
():
for
reacts
in
announced
.
reaction_set
.
all
():
html_string_2
+=
"{}: {}"
.
format
(
reacts
.
name
,
reacts
.
tally
)
html_string_2
+=
"{}: {}<br/>"
.
format
(
reacts
.
name
,
reacts
.
tally
)
html_string_2
+=
'<br/>'
html_string_final
=
html_string_1
+
html_string_2
+
"</html>"
html_string_final
=
html_string_1
+
html_string_2
+
"</html>"
...
...
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