bornhack-website/src/info/views.py

15 lines
437 B
Python
Raw Normal View History

2018-03-04 13:35:27 +00:00
from django.views.generic import ListView
from .models import *
2016-12-28 23:15:13 +00:00
from camps.mixins import CampViewMixin
2016-12-28 23:15:13 +00:00
class CampInfoView(CampViewMixin, ListView):
model = InfoCategory
template_name = 'info.html'
context_object_name = 'categories'
2016-12-28 23:15:13 +00:00
def get_queryset(self):
queryset = super(CampInfoView, self).get_queryset()
# do not show categories with 0 items
return queryset.exclude(infoitems__isnull=True)