Commit 37a62fde authored by Julia Anishka's avatar Julia Anishka

updated views, url and created template for edit announcement page

parent fb4a5bfc
{% extends 'base.html' %}
{% block title %} Edit Announcement {% endblock %}
{% block header %}
<h1> Edit announcement: </h1>
{% endblock %}
{% block body %}
<form method='POST'>
{% csrf_token %}
{{ form }}
<input type="Submit" value="Save Changes to Announcement">
</form>
{% endblock %}
from django.urls import path
from . import views
from .views import (AnnouncementsCreateView,
from .views import (AnnouncementsCreateView, AnnouncementsUpdateView,
)
urlpatterns = [
path('', views.announcement_view, name='announcements'),
path('announcements/add/', AnnouncementsCreateView.as_view(), name='announcement-add'),
path('announcements/<int:pk>/details/edit/', AnnouncementsUpdateView.as_view(), name='announcement-edit'),
]
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic.edit import CreateView
from django.views.generic.edit import CreateView, UpdateView
from .models import Announcement, Reaction
......@@ -15,4 +15,9 @@ def announcement_view(request):
class AnnouncementsCreateView(CreateView):
model = Announcement
template_name = 'announcementboard/announcement-add.html'
fields = '__all__'
class AnnouncementsUpdateView(UpdateView):
model = Announcement
template_name = 'announcementboard/announcement-edit.html'
fields = '__all__'
\ No newline at end of file
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