bornhack-website/src/sponsors/views.py

20 lines
575 B
Python
Raw Normal View History

2017-07-15 09:00:59 +00:00
from django.views.generic import TemplateView, ListView
2016-12-28 23:15:13 +00:00
from camps.mixins import CampViewMixin
2017-07-15 09:00:59 +00:00
from .models import Sponsor
2016-12-28 23:15:13 +00:00
2017-07-15 09:00:59 +00:00
class SponsorsView(CampViewMixin, ListView):
model = Sponsor
template_name = 'sponsors.html'
context_object_name = 'sponsors'
def get_queryset(self, **kwargs):
queryset = super().get_queryset()
return queryset.filter(tier__camp=self.camp).order_by('tier__weight')
2016-12-28 23:15:13 +00:00
class CallForSponsorsView(CampViewMixin, TemplateView):
def get_template_names(self):
return '%s_call_for_sponsors.html' % self.camp.slug