2016-12-25 14:52:55 +00:00
|
|
|
from camps.models import Camp
|
|
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
|
|
|
|
|
2016-12-28 23:15:13 +00:00
|
|
|
class CampViewMixin(object):
|
2016-12-25 14:52:55 +00:00
|
|
|
def dispatch(self, request, *args, **kwargs):
|
2016-12-28 23:15:13 +00:00
|
|
|
self.camp = get_object_or_404(Camp, slug=self.kwargs['camp_slug'])
|
2016-12-25 14:52:55 +00:00
|
|
|
return super(CampViewMixin, self).dispatch(request, *args, **kwargs)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
2016-12-28 23:15:13 +00:00
|
|
|
queryset = super(CampViewMixin, self).get_queryset()
|
|
|
|
return queryset.filter(camp=self.camp)
|
|
|
|
|
2016-12-25 14:52:55 +00:00
|
|
|
|