2016-12-25 14:52:55 +00:00
|
|
|
from django.shortcuts import render
|
|
|
|
from django.views.generic import ListView, DetailView
|
|
|
|
from django.utils import timezone
|
|
|
|
from .models import *
|
2016-12-28 23:15:13 +00:00
|
|
|
from camps.mixins import CampViewMixin
|
2016-12-25 14:52:55 +00:00
|
|
|
|
2016-12-28 23:15:13 +00:00
|
|
|
class CampInfoView(CampViewMixin, ListView):
|
2016-12-25 14:52:55 +00:00
|
|
|
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)
|
2016-12-25 14:52:55 +00:00
|
|
|
|