Commit 8a8d3f8f authored by Michael Lopez's avatar Michael Lopez

added forms.py for announcement-add.html

parent 615b8618
from django import forms
from .models import Announcement
class AddAnnouncement(forms.ModelForm):
class Meta:
model = Announcement
fields = "__all__"
\ No newline at end of file
...@@ -5,6 +5,7 @@ from .views import pageview ...@@ -5,6 +5,7 @@ from .views import pageview
urlpatterns = [ urlpatterns = [
path('', pageview, name='pageview'), path('', pageview, name='pageview'),
path('<int:pk>/details/', AnnouncementDetailView.as_view(), name="announcement_details"), path('<int:pk>/details/', AnnouncementDetailView.as_view(), name="announcement_details"),
path("add/", )
] ]
app_name = "announcements" app_name = "announcements"
\ No newline at end of file
...@@ -7,7 +7,7 @@ from django.shortcuts import render ...@@ -7,7 +7,7 @@ from django.shortcuts import render
def pageview(request): def pageview(request):
model_object = Announcement.objects.order_by("-pub_datetime") model_object = Announcement.objects.order_by("-pub_datetime")
return render(request, "announcement.html", context={"announcement_list":model_object}) return render(request, "announcements/announcements.html", context={"announcement_list":model_object})
def UTC_to_PHTZ(utctime): def UTC_to_PHTZ(utctime):
...@@ -18,11 +18,11 @@ def UTC_to_PHTZ(utctime): ...@@ -18,11 +18,11 @@ def UTC_to_PHTZ(utctime):
class AnnouncementListView(ListView): class AnnouncementListView(ListView):
model = Announcement model = Announcement
template_name = "announcements.html" template_name = "announcements/announcements.html"
class AnnouncementDetailView(DetailView): class AnnouncementDetailView(DetailView):
model = Announcement model = Announcement
template_name = "announcement-detail.html" template_name = "announcements/announcement-detail.html"
def get_announcement_detail(self, **kwargs): def get_announcement_detail(self, **kwargs):
announcement = self.get_object() announcement = self.get_object()
......
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