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
69139449
Commit
69139449
authored
May 23, 2022
by
nekopilar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed URLs of project and forum
parent
40891a4a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
84 additions
and
2 deletions
+84
-2
0005_alter_post_post_pic.py
forum/migrations/0005_alter_post_post_pic.py
+18
-0
models.py
forum/models.py
+1
-1
forum_index.css
forum/static/forum/forum_index.css
+13
-0
post_form.css
forum/static/forum/post_form.css
+14
-0
index.html
forum/templates/forum/index.html
+1
-0
post_detail.html
forum/templates/forum/post_detail.html
+5
-1
post_form.html
forum/templates/forum/post_form.html
+21
-0
views.py
forum/views.py
+7
-0
urls.py
..._can_i_be_on_my_own_i_have_the_hello_world_to_see/urls.py
+4
-0
No files found.
forum/migrations/0005_alter_post_post_pic.py
0 → 100644
View file @
69139449
# Generated by Django 4.0.3 on 2022-05-23 15:27
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0004_post_post_pic'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'post'
,
name
=
'post_pic'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
'media/forum'
),
),
]
forum/models.py
View file @
69139449
...
@@ -7,7 +7,7 @@ class Post(models.Model):
...
@@ -7,7 +7,7 @@ class Post(models.Model):
post_body
=
models
.
TextField
()
post_body
=
models
.
TextField
()
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
post_pic
=
models
.
FileField
(
upload_to
=
"uploads
"
,
null
=
True
,
blank
=
True
)
post_pic
=
models
.
ImageField
(
upload_to
=
"media/forum
"
,
null
=
True
,
blank
=
True
)
class
Reply
(
models
.
Model
):
class
Reply
(
models
.
Model
):
reply_body
=
models
.
TextField
()
reply_body
=
models
.
TextField
()
...
...
forum/static/forum/forum_index.css
View file @
69139449
...
@@ -16,3 +16,16 @@
...
@@ -16,3 +16,16 @@
.post-link
:hover
{
.post-link
:hover
{
margin-left
:
20px
;
margin-left
:
20px
;
}
}
.new-post-link
{
text-decoration
:
none
;
font-family
:
Khula
;
color
:
black
;
font-size
:
26px
;
padding
:
10px
;
width
:
fit-content
;
transition
:
0.2s
ease-in-out
;
}
.new-post-link
:hover
{
background-color
:
rgba
(
0
,
0
,
0
,
0.8
);
color
:
white
;
}
\ No newline at end of file
forum/static/forum/post_form.css
View file @
69139449
label
{
font-family
:
Khula
;
font-weight
:
600
;
}
input
{
font-family
:
Khula
;
}
p
{
margin
:
30px
0px
;
}
form
{
padding-bottom
:
20px
;
}
\ No newline at end of file
forum/templates/forum/index.html
View file @
69139449
...
@@ -26,4 +26,5 @@ Welcome to Widget's Forum!
...
@@ -26,4 +26,5 @@ Welcome to Widget's Forum!
</li>
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
<a
class=
"new-post-link"
href=
"/posts/add"
>
New Forum Post
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
forum/templates/forum/post_detail.html
View file @
69139449
...
@@ -13,7 +13,11 @@
...
@@ -13,7 +13,11 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
{% if object.post_pic != None and object.post_pic != '' %}
<img
width=
1000
height=
200
src=
"{% get_media_prefix %}{{object.post_pic}}"
/>
{% else %}
<img
width=
1000
height=
200
src=
"{% static 'forum/default_forumpic.png' %}"
/>
<img
width=
1000
height=
200
src=
"{% static 'forum/default_forumpic.png' %}"
/>
{% endif %}
<p
class=
"post-author"
>
by {{object.author.first_name}} {{object.author.last_name}}, {{object.pub_date | date:"d/m/o"}}
</p>
<p
class=
"post-author"
>
by {{object.author.first_name}} {{object.author.last_name}}, {{object.pub_date | date:"d/m/o"}}
</p>
<p>
{{object.post_body}}
</p>
<p>
{{object.post_body}}
</p>
<ul>
<ul>
...
...
forum/templates/forum/post_form.html
View file @
69139449
<!-- forum/post_form.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Forum{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'forum/post_form.css' %}"
>
{% endblock %}
{% block header %}
Add Post
{% endblock %}
{% block content %}
<form
enctype=
"multipart/form-data"
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Post"
>
</form>
{% endblock %}
\ No newline at end of file
forum/views.py
View file @
69139449
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
.models
import
Post
,
Reply
from
.models
import
Post
,
Reply
...
@@ -20,3 +21,9 @@ class ForumDetailView(DetailView):
...
@@ -20,3 +21,9 @@ class ForumDetailView(DetailView):
return
context
return
context
class
PostCreateView
(
CreateView
):
model
=
Post
fields
=
[
"post_body"
,
"post_title"
,
"author"
,
"post_pic"
]
def
get_success_url
(
self
):
return
"/forum/"
\ No newline at end of file
widget_father_when_can_i_be_on_my_own_i_have_the_hello_world_to_see/urls.py
View file @
69139449
...
@@ -18,11 +18,15 @@ from django.urls import path, include
...
@@ -18,11 +18,15 @@ from django.urls import path, include
from
django.conf.urls.static
import
static
from
django.conf.urls.static
import
static
from
django.conf
import
settings
from
django.conf
import
settings
from
homepage.views
import
WidgetUserCreateView
from
homepage.views
import
WidgetUserCreateView
from
forum.views
import
PostCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
'homepage/'
,
include
(
"homepage.urls"
,
namespace
=
'homepage'
)),
path
(
'homepage/'
,
include
(
"homepage.urls"
,
namespace
=
'homepage'
)),
path
(
'users/add'
,
WidgetUserCreateView
.
as_view
(),
path
(
'users/add'
,
WidgetUserCreateView
.
as_view
(),
name
=
'widgetuser_form'
),
name
=
'widgetuser_form'
),
path
(
'posts/add'
,
PostCreateView
.
as_view
(),
name
=
'post_form'
),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'forum/'
,
include
(
"forum.urls"
,
namespace
=
'forum'
)),
path
(
'forum/'
,
include
(
"forum.urls"
,
namespace
=
'forum'
)),
path
(
'announcements/'
,
include
(
"announcement_board.urls"
,
path
(
'announcements/'
,
include
(
"announcement_board.urls"
,
...
...
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