Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm-group3
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
John Michael T. Amador
midterm-group3
Commits
6ccf5db8
Commit
6ccf5db8
authored
May 13, 2023
by
Ron Rodillas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the edit post page
parent
5df3ae23
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
3 deletions
+41
-3
db.sqlite3
widget_group3/db.sqlite3
+0
-0
models.cpython-39.pyc
widget_group3/forum/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
widget_group3/forum/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_group3/forum/__pycache__/views.cpython-39.pyc
+0
-0
0007_remove_forumpost_replies_alter_reply_forum_post.py
...s/0007_remove_forumpost_replies_alter_reply_forum_post.py
+23
-0
0007_remove_forumpost_replies_alter_reply_forum_post.cpython-39.pyc
...e_forumpost_replies_alter_reply_forum_post.cpython-39.pyc
+0
-0
models.py
widget_group3/forum/models.py
+4
-1
forumpost-details.html
widget_group3/forum/templates/forum/forumpost-details.html
+1
-1
forumpost-edit.html
widget_group3/forum/templates/forum/forumpost-edit.html
+6
-0
urls.py
widget_group3/forum/urls.py
+1
-0
views.py
widget_group3/forum/views.py
+6
-1
No files found.
widget_group3/db.sqlite3
View file @
6ccf5db8
No preview for this file type
widget_group3/forum/__pycache__/models.cpython-39.pyc
View file @
6ccf5db8
No preview for this file type
widget_group3/forum/__pycache__/urls.cpython-39.pyc
View file @
6ccf5db8
No preview for this file type
widget_group3/forum/__pycache__/views.cpython-39.pyc
View file @
6ccf5db8
No preview for this file type
widget_group3/forum/migrations/0007_remove_forumpost_replies_alter_reply_forum_post.py
0 → 100644
View file @
6ccf5db8
# Generated by Django 4.1.7 on 2023-05-13 16:10
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0006_forumpost_replies'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'forumpost'
,
name
=
'replies'
,
),
migrations
.
AlterField
(
model_name
=
'reply'
,
name
=
'forum_post'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'post_replies'
,
to
=
'forum.forumpost'
),
),
]
widget_group3/forum/migrations/__pycache__/0007_remove_forumpost_replies_alter_reply_forum_post.cpython-39.pyc
0 → 100644
View file @
6ccf5db8
File added
widget_group3/forum/models.py
View file @
6ccf5db8
...
@@ -7,7 +7,7 @@ class ForumPost (models.Model):
...
@@ -7,7 +7,7 @@ class ForumPost (models.Model):
body
=
models
.
TextField
()
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
'dashboard.WidgetUser'
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
author
=
models
.
ForeignKey
(
'dashboard.WidgetUser'
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
pub_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
)
pub_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
)
replies
=
models
.
ManyToManyField
(
'self'
,
blank
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
...
@@ -18,6 +18,9 @@ class ForumPost (models.Model):
...
@@ -18,6 +18,9 @@ class ForumPost (models.Model):
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'forum:PostDetailView'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'forum:PostDetailView'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_update_url
(
self
):
return
reverse
(
'forum:PostUpdateView'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Reply
(
models
.
Model
):
class
Reply
(
models
.
Model
):
body
=
models
.
TextField
()
body
=
models
.
TextField
()
...
...
widget_group3/forum/templates/forum/forumpost-details.html
View file @
6ccf5db8
...
@@ -28,5 +28,5 @@ by {{reply.author.first_name}} {{reply.author.last_name}} <br>
...
@@ -28,5 +28,5 @@ by {{reply.author.first_name}} {{reply.author.last_name}} <br>
{% endfor %}
{% endfor %}
</p2>
</p2>
<br>
<br>
<
button>
Edit Post
</button
>
<
a
href =
"{{object.get_update_url}}"
><button>
Edit Post
</button></a
>
{% endblock %}
{% endblock %}
\ No newline at end of file
widget_group3/forum/templates/forum/forumpost-edit.html
View file @
6ccf5db8
...
@@ -2,10 +2,16 @@
...
@@ -2,10 +2,16 @@
{% load static %}
{% load static %}
{% block title %}
{% block title %}
Edit Post
{% endblock %}
{% endblock %}
{% block styles %}
{% block styles %}
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
<h1>
Edit Post
</h1><br>
<form
method=
"POST"
enctype=
"multipart/form-data"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Changes to Post"
>
{% endblock %}
{% endblock %}
\ No newline at end of file
widget_group3/forum/urls.py
View file @
6ccf5db8
...
@@ -5,6 +5,7 @@ urlpatterns = [
...
@@ -5,6 +5,7 @@ urlpatterns = [
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'forumposts/add/'
,
PostCreateView
.
as_view
(),
name
=
'addPost'
),
path
(
'forumposts/add/'
,
PostCreateView
.
as_view
(),
name
=
'addPost'
),
path
(
'forumposts/<int:pk>/details'
,
PostDetailView
.
as_view
(),
name
=
'PostDetailView'
),
path
(
'forumposts/<int:pk>/details'
,
PostDetailView
.
as_view
(),
name
=
'PostDetailView'
),
path
(
'forumposts/<int:pk>/edit'
,
PostUpdateView
.
as_view
(),
name
=
'PostUpdateView'
),
]
]
app_name
=
"forum"
app_name
=
"forum"
\ No newline at end of file
widget_group3/forum/views.py
View file @
6ccf5db8
...
@@ -14,6 +14,11 @@ class PostCreateView(CreateView):
...
@@ -14,6 +14,11 @@ class PostCreateView(CreateView):
fields
=
'__all__'
fields
=
'__all__'
template_name
=
'forum/forumpost-add.html'
template_name
=
'forum/forumpost-add.html'
class
PostUpdateView
(
UpdateView
):
model
=
ForumPost
fields
=
'__all__'
template_name
=
'forum/forumpost-edit.html'
class
PostDetailView
(
DetailView
):
class
PostDetailView
(
DetailView
):
model
=
ForumPost
model
=
ForumPost
template_name
=
'forum/forumpost-details.html'
template_name
=
'forum/forumpost-details.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