Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_father when can i be on my own i have the hello world to see
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
father when can i be on my own i have the hello world to see
widget_father when can i be on my own i have the hello world to see
Commits
3736d8fc
Commit
3736d8fc
authored
May 19, 2022
by
nekopilar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added styling to template and image
parent
175beaf3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
4 deletions
+57
-4
0004_post_post_pic.py
forum/migrations/0004_post_post_pic.py
+18
-0
default_forumpic.PNG
forum/static/forum/default_forumpic.PNG
+0
-0
index.html
forum/templates/forum/index.html
+2
-2
post_detail.html
forum/templates/forum/post_detail.html
+31
-0
views.py
forum/views.py
+6
-2
No files found.
forum/migrations/0004_post_post_pic.py
0 → 100644
View file @
3736d8fc
# Generated by Django 4.0.3 on 2022-05-19 13:53
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0003_reply_post'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'post'
,
name
=
'post_pic'
,
field
=
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
'uploads'
),
),
]
forum/static/forum/default_forumpic.PNG
0 → 100644
View file @
3736d8fc
5.33 KB
forum/templates/forum/index.html
View file @
3736d8fc
...
...
@@ -2,10 +2,10 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}
Announcements
{% endblock %}
{% block title %}
Forum
{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static '
announcement_board/announcement
_index.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static '
forum/forum
_index.css' %}"
>
{% endblock %}
{% block header %}
...
...
forum/templates/forum/post_detail.html
View file @
3736d8fc
<!-- forum/forum_detail.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Homepage{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'forum/forum_detail.css' %}"
>
{% endblock %}
{% block header %}
{{object.forum_title}}
{% endblock %}
{% block content %}
<img
width=
1000
height=
200
src=
"{% static 'forum/default_forumpic.png' %}"
/>
<p>
by {{object.author.first_name}} {{object.author.last_name}}, {{object.pub_date | date:"d/m/o"}}
</p>
<p>
{{object.post_body}}
</p>
<ul>
{% for reply in replies %}
<li>
<p
class=
"post-link"
>
{{reply.author.first_name}}
{{reply.author.last_name}},
{{reply.pub_date | date:"d/m/o"}}:
{{reply.reply_body}}
</p>
</br>
</li>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
forum/views.py
View file @
3736d8fc
...
...
@@ -7,12 +7,16 @@ from .models import Post, Reply
class
ForumView
(
View
):
def
get
(
self
,
request
):
objects_set
=
{
"all_posts"
:
[
obj
for
obj
in
Post
.
objects
.
all
()]
"all_posts"
:
[
obj
for
obj
in
Post
.
objects
.
all
()
.
order_by
(
'-pub_date'
)
]
}
return
render
(
request
,
'forum/index.html'
,
objects_set
)
class
ForumDetailView
(
DetailView
):
model
=
Post
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'replies'
]
=
Reply
.
objects
.
filter
(
post_id
=
self
.
kwargs
[
'pk'
])
.
all
()
.
order_by
(
'-pub_date'
)
return
context
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