Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widgets_FEKK
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
Kyla Martin
widgets_FEKK
Commits
784990b0
Commit
784990b0
authored
May 04, 2022
by
Emmanuel Linus T. Evangelista
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update index page for Forum
parent
32d35732
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
17 deletions
+52
-17
index.css
WidgetFEKK/Forum/static/Forum/index.css
+29
-0
index.html
WidgetFEKK/Forum/templates/Forum/index.html
+22
-0
views.py
WidgetFEKK/Forum/views.py
+1
-17
No files found.
WidgetFEKK/Forum/static/Forum/index.css
0 → 100644
View file @
784990b0
body
{
padding
:
64px
160px
;
}
#title
{
margin
:
0
0
64px
;
}
#subtitle
{
margin
:
0
0
16px
;
}
.posts
{
padding
:
0
;
}
.posts
>
li
{
margin
:
0
0
16px
;
width
:
80%
;
}
.posts
>
li
a
{
color
:
black
;
text-decoration
:
none
;
}
.posts
>
li
a
:hover
{
text-decoration
:
underline
;
}
\ No newline at end of file
WidgetFEKK/Forum/templates/Forum/index.html
0 → 100644
View file @
784990b0
{% extends "base.html" %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/styles.css' %}"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/index.css' %}"
>
{% endblock %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
<article>
<h1
id=
"title"
>
Welcome to Widget's Forum!
</h1>
<h5
id=
"subtitle"
>
Forum posts:
</h5>
<ul
class=
"posts"
>
{% for post in posts_sorted %}
<li><a
href=
"/posts/{{ post.pk }}/details"
><strong>
{{ post.post_title }}
</strong>
by
<strong>
{{ post.author.first_name }} {{ post.author.last_name }}
</strong>
dated
<strong>
{{ post.pub_date|date:"d/m/Y" }}
</strong></a></li>
{% endfor %}
</ul>
</article>
{% endblock %}
\ No newline at end of file
WidgetFEKK/Forum/views.py
View file @
784990b0
...
...
@@ -6,23 +6,7 @@ def get_readable_time(timestamp):
return
timestamp
.
strftime
(
"
%
m/
%
d/
%
Y"
)
def
index
(
request
):
out
=
"FORUM POSTS: <br />"
posts
=
Post
.
objects
.
all
()
for
post
in
posts
:
out
+=
f
'{post.post_title} by {post.author.first_name} {post.author.last_name} dated {get_readable_time(post.pub_date)}: <br />'
out
+=
f
'{post.post_body} <br />'
post_replies
=
post
.
reply_set
.
all
()
for
reply
in
post_replies
:
out
+=
f
'Reply by {reply.author.first_name} {reply.author.last_name} dated {get_readable_time(reply.pub_date)}: <br />'
out
+=
f
'{reply.reply_body} <br />'
out
+=
'<br />'
return
HttpResponse
(
out
)
return
render
(
request
,
'Forum/index.html'
,
{
'posts_sorted'
:
Post
.
objects
.
order_by
(
'-pub_date'
)})
def
details
(
request
,
post_id
):
try
:
...
...
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