blob: eec7d3646e15d8f1a62a4c928607ea71421477da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.views.generic.base import TemplateView
from archive.models import Archive, ArchiveCategory
class ArchiveView(TemplateView):
"""
class-based view to show archives
"""
template_name = 'archive/archive.html'
def get_context_data(self, **kwargs):
"""
add 'user' context
"""
context = super(type(self), self).get_context_data(**kwargs)
archive_categories = ArchiveCategory.objects.all()
if Archive.objects.all():
archive_empty = False
else:
archive_empty = True
context['archive_categories'] = archive_categories
context['archive_empty'] = archive_empty
return context
|