Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
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
Ysabella Panghulan
midterm_princessgabi
Commits
b2d9be06
Commit
b2d9be06
authored
May 11, 2023
by
Trisha Angel Millena
Committed by
Ysabella Panghulan
May 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Edit Post Page: created forumpost-edit.html,edited urls.py, edited views.py
parent
bd929499
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
2 deletions
+34
-2
views.cpython-39.pyc
widget_princessgabi/forum/__pycache__/views.cpython-39.pyc
+0
-0
forumpost-edit.html
...et_princessgabi/forum/templates/forum/forumpost-edit.html
+26
-0
urls.py
widget_princessgabi/forum/urls.py
+2
-1
views.py
widget_princessgabi/forum/views.py
+6
-1
No files found.
widget_princessgabi/forum/__pycache__/views.cpython-39.pyc
View file @
b2d9be06
No preview for this file type
widget_princessgabi/forum/templates/forum/forumpost-edit.html
0 → 100644
View file @
b2d9be06
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Post{% endblock %}
{% block content %}
{{ form.non_field_errors }}
{% for field in form %}
{% if field.errors %}
<p>
{{ field.label }}has the following errors:
</p>
<ul>
{% for error in field.errors %}
<li>
{{ error }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
<h1>
Edit Post:
</h1>
<form
method =
'POST'
>
{% csrf_token %}
{{ form.as_p }}
<input
type =
"submit"
value =
"Save Changes to Post"
>
</form>
{% endblock %}
\ No newline at end of file
widget_princessgabi/forum/urls.py
View file @
b2d9be06
from
django.urls
import
path
from
.views
import
forum
,
ForumPostDetailView
,
ForumPostCreateView
from
.views
import
forum
,
ForumPostDetailView
,
ForumPostCreateView
,
ForumPostUpdateView
urlpatterns
=
[
path
(
''
,
forum
,
name
=
"forum"
),
path
(
"forum/forumposts/<int:pk>/details/"
,
ForumPostDetailView
.
as_view
(),
name
=
"forumpost-details"
),
path
(
'forumposts/add'
,
ForumPostCreateView
.
as_view
(),
name
=
"forumpost-add"
),
path
(
'forumposts/<int:pk>/edit'
,
ForumPostUpdateView
.
as_view
(),
name
=
"forumpost-edit"
)
]
app_name
=
"forum"
\ No newline at end of file
widget_princessgabi/forum/views.py
View file @
b2d9be06
...
...
@@ -2,7 +2,7 @@ from django.shortcuts import render
from
django.http
import
HttpResponse
from
.models
import
ForumPost
,
Reply
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
,
UpdateView
def
forum
(
request
):
posts
=
ForumPost
.
objects
.
all
()
...
...
@@ -21,3 +21,8 @@ class ForumPostCreateView(CreateView):
model
=
ForumPost
template_name
=
'forum/forumpost-add.html'
fields
=
'__all__'
class
ForumPostUpdateView
(
UpdateView
):
model
=
ForumPost
template_name
=
'forum/forumpost-edit.html'
fields
=
'__all__'
\ No newline at end of file
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