bornhack-website/src/info/views.py
2018-03-04 14:35:27 +01:00

15 lines
437 B
Python

from django.views.generic import ListView
from .models import *
from camps.mixins import CampViewMixin
class CampInfoView(CampViewMixin, ListView):
model = InfoCategory
template_name = 'info.html'
context_object_name = 'categories'
def get_queryset(self):
queryset = super(CampInfoView, self).get_queryset()
# do not show categories with 0 items
return queryset.exclude(infoitems__isnull=True)