bornhack-website/info/views.py

17 lines
519 B
Python
Raw Normal View History

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-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)