Commit e8f4b864 authored by Eury See's avatar Eury See

Created an Edit Forum Post Page for the Forum Application.

parent ec031afe
<title>{% block title %} Edit Post {% endblock %}</title>
{% block styles %}
<style>
body {
background-color: #E8D1C5;
font-family: Georgia, serif;
font-size: 16px;
font-weight: bold;
color: #a77f6a;
}
</style>
{% endblock %}
{% block content %}
<div style="text-align: left;">
<h1>Edit Post</h1>
</div>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Save Changes to Post</button>
</form>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import (
index, forum, ForumDetailView, AddForumPostView)
index, forum, ForumDetailView, AddForumPostView, EditForumPostView)
from . import views
urlpatterns = [
......@@ -8,7 +8,7 @@ urlpatterns = [
path('forum/', forum, name='forum'),
path('forum/forumposts/<int:pk>/details/', ForumDetailView.as_view(), name='forumpost-details'),
path('forum/forumposts/add/', AddForumPostView.as_view(), name='forumpost-add'),
path('forum/forumposts/<pk>/edit/', EditForumPostView.as_view(), name = 'forumpost-edit'),
]
app_name = "Forum"
\ No newline at end of file
......@@ -3,6 +3,7 @@ from django.http import HttpResponse
from django.views import View
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.views.generic.edit import UpdateView
from .models import ForumPost, Reply
......@@ -37,8 +38,7 @@ class AddForumPostView(CreateView):
fields = ['title', 'body', 'author']
template_name = 'forumpost-add.html'
class AddForumPostView(CreateView):
class EditForumPostView(UpdateView):
model = ForumPost
fields = ['title', 'body', 'author']
template_name = 'forumpost-add.html'
template_name = 'forumpost-edit.html'
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment