bornhack-website/src/info/views.py

17 lines
450 B
Python
Raw Normal View History

2018-03-04 13:35:27 +00:00
from django.views.generic import ListView
2016-12-28 23:15:13 +00:00
from camps.mixins import CampViewMixin
from .models import InfoCategory
2019-06-16 12:32:24 +00:00
2016-12-28 23:15:13 +00:00
class CampInfoView(CampViewMixin, ListView):
model = InfoCategory
2019-06-16 12:32:24 +00:00
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)