Commit 72f9c57e authored by Javi Ng's avatar Javi Ng

created announcement-details template

parent 3255bb11
......@@ -16,7 +16,7 @@ class Announcement(models.Model):
return self.title
def get_absolute_url(self):
reverse('announcement-details', kwargs={'pk': self.pk})
return reverse('announcement_board:announcement-details', kwargs={'pk': self.pk})
class Reaction(models.Model):
......
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.title }} {% endblock %}
{% block content %}
<h1> {{ object.title }} </h1>
<h2> {{ object.author.displayName }} </h2>
<h3> {{ object.pub_datetime|date:"m/d/Y, h:i A" }} </h3>
<p> {{ object.body }} </p> <br>
Reactions:
<ul>
{% for reaction in object.reactlist.all %}
<li> {{ reaction.name}}: {{ reaction.tally }} </li>
{% endfor %}
</ul>
<form action="../edit">
<button type="Submit">Edit Announcement</button>
</form>
{% endblock %}
\ No newline at end of file
......@@ -3,9 +3,9 @@ from . import views
urlpatterns = [
path("", views.announcements, name="announcements"),
path("<int:pk>/details/", views.AnnouncementDetailView.as_view(), name="announcement-details"),
path("add/", views.AnnouncementCreateView.as_view(), name="announcement-add"),
path("<int:pk>/edit/", views.AnnouncementUpdateView.as_view(), name="announcement-update"),
path("<int:pk>/details/", views.AnnouncementDetailView.as_view(), name="announcementdetail"),
path("add/", views.AnnouncementCreateView.as_view(), name="announcementadd"),
path("<int:pk>/edit/", views.AnnouncementUpdateView.as_view(), name="announcementupdate"),
]
......
......@@ -8,7 +8,7 @@ from django.shortcuts import render
def announcements(request):
context = {
"announcement_list" : Announcement.objects.all().order_by('pub_date'),
"announcement_list" : Announcement.objects.all().order_by('pub_datetime'),
}
return render(request, 'announcement_board/announcements.html', context)
......
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