2016-12-28 23:15:13 +00:00
|
|
|
from camps.mixins import CampViewMixin
|
2020-06-22 15:25:08 +00:00
|
|
|
from django.views.generic import ListView
|
2016-12-25 14:52:55 +00:00
|
|
|
|
2020-02-12 12:10:41 +00:00
|
|
|
from .models import InfoCategory
|
|
|
|
|
2019-06-16 12:32:24 +00:00
|
|
|
|
2016-12-28 23:15:13 +00:00
|
|
|
class CampInfoView(CampViewMixin, ListView):
|
2016-12-25 14:52:55 +00:00
|
|
|
model = InfoCategory
|
2019-06-16 12:32:24 +00:00
|
|
|
template_name = "info.html"
|
|
|
|
context_object_name = "categories"
|
2016-12-25 14:52:55 +00:00
|
|
|
|
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)
|