Commit 2a608fe1 authored by Michael Lopez's avatar Michael Lopez

edited views.py: created the necessary details to render page

parent f623ad47
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>{{object.title}}</h1> <br> <h2>{{object.title}}</h2> <br>
<h2> by {{object.author.first_name}} {{object.author.last_name}}</h2> <br> <h3> by {{object.author.first_name}} {{object.author.last_name}}</h3> <br>
{{pubpost.datetime}} <br> <br> <br> <p>{{pubpost.datetime}}</p> <br> <br> <br>
<li>{{object.body}}</li> <li>{{object.body}}</li>
<br><br> <br><br>
...@@ -18,7 +18,4 @@ Angry: {{angry_count}} ...@@ -18,7 +18,4 @@ Angry: {{angry_count}}
<form action='edit'> <form action='edit'>
<input type="submit" value="Edit Announcement"/> <input type="submit" value="Edit Announcement"/>
</form> </form>
{% endblock %} {% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import AnnouncementDetailView from .views import AnnouncementDetailView
from .views import pageview from .views import pageview
urlpatterns = [ urlpatterns = [
......
import pytz import pytz # need to do "pip install pytz" for this to be activated
from .models import Announcement, Reaction from .models import Announcement, Reaction
from django.utils import timezone from django.utils import timezone
from django.views.generic import ListView, DetailView from django.views.generic import ListView, DetailView
from django.db.models import Sum from django.db.models import Sum
from django.shortcuts import render
def pageview(request):
model_object = Announcement.objects.order_by("-pub_datetime")
return render(request, "announcement.html", context={"announcement_list":model_object})
def UTC_to_PHTZ(utctime): def UTC_to_PHTZ(utctime):
ph_tz = "%m/%d/%Y, %I:%M %p" ph_tz = "%m/%d/%Y, %I:%M %p"
...@@ -29,3 +35,4 @@ class AnnouncementDetailView(DetailView): ...@@ -29,3 +35,4 @@ class AnnouncementDetailView(DetailView):
context['pubpost_datetime'] = UTC_to_PHTZ(announcement.pub_datetime) context['pubpost_datetime'] = UTC_to_PHTZ(announcement.pub_datetime)
return context return 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