Commit 7afc1b6a authored by Alia Lawraine Olay's avatar Alia Lawraine Olay

Changed announcement_list_view from FBV to CBV

parent 60652b06
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views.generic.list import ListView from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .models import Announcement from .models import Announcement
def announcement_list_view(request): class AnnouncementListView(ListView):
context = {} queryset = Announcement.objects.order_by('-pub_date')
context['object_list'] = Announcement.objects.order_by('-pub_date').all()
return render(request, 'announcementboard/announcement_list.html', context)
def announcement_detail_view(request, pk): def announcement_detail_view(request, pk):
......
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