Commit ba68f516 authored by Jiuvi Anne Hu's avatar Jiuvi Anne Hu

Added correct imports and fixed miscellaneous issues.

parent e92d174c
......@@ -15,7 +15,7 @@
<a href = "/Dashboard/">Dashboard</a><br>
<a href = "/forum/">Forum</a><br>
<a href = "/Assignments/">Assignments</a><br>
<a href = "/assignments/">Assignments</a><br>
<a href = "/widget_Calendar/">Calendar</a>
{% endblock content %}
\ No newline at end of file
from django.urls import path
from .views import index
from .views import index, AnnouncementDetailView, AnnouncementAddView, AnnouncementEditView
urlpatterns = [
path('announcements/', index, name='index'),
path('announcements/<int:pk>/details/', AnnouncementDetailView.as_view(), name='announcement-detail'),
path('announcements/add/', AnnouncementDetailView.as_view(), name='announcement-add'),
path('announcements/<int:pk>/edit/', AnnouncementDetailView.as_view(), name='announcement-edit'),
path('announcements/add/', AnnouncementAddView.as_view(), name='announcement-add'),
path('announcements/<int:pk>/edit/', AnnouncementEditView.as_view(), name='announcement-edit'),
]
app_name = "announcements"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
from .models import Announcement, Reaction
import pytz
from django.utils import timezone
......@@ -20,13 +21,13 @@ def index(request):
return render(request, 'announcements/announcements.html', context)
class AnnouncementDetailView(DetailView)
class AnnouncementDetailView(DetailView):
model = Announcement
template_name = 'announcements/announcement-detail.html'
queryset = Annoucement.objects.all()
queryset = Announcement.objects.all()
context_object_name = 'annoucement-details'
class AnnouncementAddView(CreateView)
class AnnouncementAddView(CreateView):
model = Announcement
fields = '__all__'
template_name = 'announcement-add.html'
......@@ -35,7 +36,7 @@ class AnnouncementAddView(CreateView)
return reverse('announcement:announcementdetailview', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
class AnnouncementEditView(UpdateView)
class AnnouncementEditView(UpdateView):
model = Announcement
template_name = 'announcements/announcement-edit'
......
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