Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_tee jays angelos
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
Ramon Angelo Enriquez
widget_tee jays angelos
Commits
c725a7b2
Commit
c725a7b2
authored
May 17, 2022
by
Ryan Angelo G. Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added template and CSS Styling to Forum App
parent
7380380e
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
171 additions
and
31 deletions
+171
-31
Bee Movie.jpg
widget_tee_jays_angelos/forum/static/forum/Bee Movie.jpg
+0
-0
Enriquez.jpg
widget_tee_jays_angelos/forum/static/forum/Enriquez.jpg
+0
-0
Goodbye.jpg
widget_tee_jays_angelos/forum/static/forum/Goodbye.jpg
+0
-0
Hello.jpg
widget_tee_jays_angelos/forum/static/forum/Hello.jpg
+0
-0
Lim.jpg
widget_tee_jays_angelos/forum/static/forum/Lim.jpg
+0
-0
Sumawang.jpg
widget_tee_jays_angelos/forum/static/forum/Sumawang.jpg
+0
-0
Sy.jpg
widget_tee_jays_angelos/forum/static/forum/Sy.jpg
+0
-0
style.css
widget_tee_jays_angelos/forum/static/forum/style.css
+58
-0
base.html
widget_tee_jays_angelos/forum/templates/forum/base.html
+17
-0
details.html
widget_tee_jays_angelos/forum/templates/forum/details.html
+19
-0
index.html
widget_tee_jays_angelos/forum/templates/forum/index.html
+15
-0
urls.py
widget_tee_jays_angelos/forum/urls.py
+2
-1
views.py
widget_tee_jays_angelos/forum/views.py
+60
-30
No files found.
widget_tee_jays_angelos/forum/static/forum/Bee Movie.jpg
0 → 100644
View file @
c725a7b2
588 KB
widget_tee_jays_angelos/forum/static/forum/Enriquez.jpg
0 → 100644
View file @
c725a7b2
862 KB
widget_tee_jays_angelos/forum/static/forum/Goodbye.jpg
0 → 100644
View file @
c725a7b2
88.2 KB
widget_tee_jays_angelos/forum/static/forum/Hello.jpg
0 → 100644
View file @
c725a7b2
13.8 KB
widget_tee_jays_angelos/forum/static/forum/Lim.jpg
0 → 100644
View file @
c725a7b2
17 KB
widget_tee_jays_angelos/forum/static/forum/Sumawang.jpg
0 → 100644
View file @
c725a7b2
46.3 KB
widget_tee_jays_angelos/forum/static/forum/Sy.jpg
0 → 100644
View file @
c725a7b2
13 KB
widget_tee_jays_angelos/forum/static/forum/style.css
0 → 100644
View file @
c725a7b2
h1
{
color
:
lightblue
;
font-family
:
'Georgia'
;
position
:
relative
;
}
h2
{
background-color
:
black
;
color
:
white
;
font-family
:
'Georgia'
;
position
:
relative
;
}
p
{
font-family
:
'Verdana'
;
position
:
relative
;
}
li
{
font-family
:
'Verdana'
;
position
:
relative
;
}
.detailsRelatedPicture
{
width
:
75px
;
height
:
75px
;
position
:
relative
;
z-index
:
999
;
float
:
right
;
}
.RectangularShadow
{
position
:
absolute
;
left
:
0px
;
top
:
0px
;
height
:
90px
;
width
:
100%
;
background-color
:
gray
;
}
.detailsProfilePicture
{
width
:
75px
;
height
:
75px
;
position
:
relative
;
z-index
:
999
;
float
:
left
;
}
widget_tee_jays_angelos/forum/templates/forum/base.html
0 → 100644
View file @
c725a7b2
{% load static %}
<!DOCTYPE html>
<html
lang=
"en"
dir=
"ltr"
>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'forum/style.css' %}"
<
title
>
Forum
</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
widget_tee_jays_angelos/forum/templates/forum/details.html
0 → 100644
View file @
c725a7b2
{% extends "forum/base.html" %}
{% block content %}
{% if Post %}
<img
src=
"/static/forum/{{Post.post_title}}.jpg"
class=
"detailsRelatedPicture"
>
<img
src=
"/static/forum/{{Post.post_author.last_name}}.jpg"
class=
"detailsProfilePicture"
>
<div
class=
"RectangularShadow"
></div>
<h1
style=
"text-align: center"
>
{{Post.post_title}}
</h1>
<h2>
by {{Post.post_author.first_name}} {{Post.post_author.last_name}}, {{Post.pub_date}}
</h2>
<p>
{{Post.post_body}}
</p>
<h2>
Replies:
</h2>
<ul>
{% for r in reply %}
<li>
{{r.reply_author.first_name}} {{r.reply_author.last_name}}, {{r.reply_pub_date}}: {{r.reply_body}}
</li>
{% endfor %}
</ul>
{% else %}
<p>
Post not found.
</p>
{% endif %}
{% endblock %}
widget_tee_jays_angelos/forum/templates/forum/index.html
0 → 100644
View file @
c725a7b2
{% extends "forum/base.html" %}
{% block content %}
<div
class=
"RectangularShadow"
></div>
<h1
style=
"text-align: center"
>
Welcome to Widget's Forum!
</h1>
<h2>
Forum Posts:
</h2>
{% if post_list %}
<ul>
{% for Post in post_list %}
<li><a
href=
"posts/{{Post.id}}/details"
>
{{Post.post_title}}, by {{Post.post_author.last_name}}, {{Post.post_author.first_name}}, dated {{Post.pub_date}}
</a></li>
{% endfor %}
</ul>
{% else %}
<p>
No Posts are available
</p>
{% endif %}
{% endblock %}
widget_tee_jays_angelos/forum/urls.py
View file @
c725a7b2
...
...
@@ -3,5 +3,6 @@ from django.urls import path
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"forum"
)
path
(
''
,
views
.
index
,
name
=
"forum"
),
path
(
'posts/<int:post_id>/details/'
,
views
.
details
,
name
=
"details"
),
]
widget_tee_jays_angelos/forum/views.py
View file @
c725a7b2
from
django.http
import
HttpResponse
from
array
import
array
from
django.http
import
HttpResponse
,
Http404
from
forum.models
import
Post
,
Reply
,
WidgetUser
from
django.shortcuts
import
render
from
django.template
import
loader
# Create your views here.
def
index
(
request
):
entries
=
Post
.
objects
.
all
()
.
count
()
n
=
1
forum
=
"FORUM POSTS:<br/>"
while
(
n
<=
entries
):
forum
+=
getPost
(
n
)
forum
+=
getReply
(
n
)
n
+=
1
return
HttpResponse
(
forum
)
def
getPost
(
pk
):
postFirstLine
=
""
postSecondLine
=
""
post
=
""
postTitle
=
Post
.
objects
.
get
(
pk
=
pk
)
.
post_title
authorFirstName
=
Post
.
objects
.
get
(
pk
=
pk
)
.
post_author
.
first_name
authorLastName
=
Post
.
objects
.
get
(
pk
=
pk
)
.
post_author
.
last_name
publicationDate
=
Post
.
objects
.
get
(
pk
=
pk
)
.
pub_date
postBody
=
Post
.
objects
.
get
(
pk
=
pk
)
.
post_body
postFirstLine
=
"{} by {} {} dated {}:<br/>"
.
format
(
postTitle
,
authorFirstName
,
authorLastName
,
publicationDate
)
postSecondLine
=
"{}<br/>"
.
format
(
postBody
)
post
+=
postFirstLine
+
postSecondLine
return
post
post_list
=
Post
.
objects
.
order_by
(
"pub_date"
)
context
=
{
"post_list"
:
post_list
,
}
return
render
(
request
,
"forum/index.html"
,
context
)
#entries = Post.objects.all().count()
#n = 1
#forum = "FORUM POSTS:<br/>"
#while(n<=entries):
# forum += getPost(n)
# forum += getReply(n)
# n += 1
#return HttpResponse(forum)
#def getPost(pk):
# postFirstLine = ""
# postSecondLine = ""
# post = ""
# postTitle = Post.objects.get(pk=pk).post_title
# authorFirstName = Post.objects.get(pk=pk).post_author.first_name
# authorLastName = Post.objects.get(pk=pk).post_author.last_name
# publicationDate = Post.objects.get(pk=pk).pub_date
# postBody = Post.objects.get(pk=pk).post_body
# postFirstLine = "{} by {} {} dated {}:<br/>" .format(postTitle, authorFirstName, authorLastName, publicationDate)
# postSecondLine = "{}<br/>" .format(postBody)
# post += postFirstLine + postSecondLine
# return post
def
getReply
(
pk
):
replies
=
""
postReply
=
[]
for
reply
in
Post
.
objects
.
get
(
pk
=
pk
)
.
posts
.
all
():
replies
+=
"Reply by {} {} {}:<br/>{}"
.
format
(
reply
.
reply_author
.
first_name
,
reply
.
reply_author
.
last_name
,
reply
.
reply_pub_date
,
reply
.
reply_body
)
replies
+=
"<br/>"
replies
+=
"<br/>"
return
replies
postReply
.
append
(
reply
)
return
postReply
#replies = ""
#for reply in Post.objects.get(pk=pk).posts.all():
# replies += "Reply by {} {} {}:<br/>{}" .format(reply.reply_author.first_name, reply.reply_author.last_name, reply.reply_pub_date, reply.reply_body)
# replies += "<br/>"
#replies += "<br/>"
#return replies
def
details
(
request
,
post_id
):
try
:
post
=
Post
.
objects
.
get
(
pk
=
post_id
)
except
Post
.
DoesNotExist
:
raise
Http404
(
"Post does not exist!"
)
try
:
reply
=
getReply
(
pk
=
post_id
)
except
Reaction
.
DoesNotExist
:
raise
Http404
(
"Reply does not exist"
)
context
=
{
"Post"
:
post
,
"reply"
:
reply
}
return
render
(
request
,
"forum/details.html"
,
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