cleanup in camps/

This commit is contained in:
Stephan Telling 2018-03-04 15:58:20 +01:00
parent d20a964793
commit aaa4df27db
3 changed files with 3 additions and 7 deletions

View file

@ -1,6 +1,4 @@
from django.conf import settings
from .models import Camp
from django.utils import timezone
def camp(request):

View file

@ -22,5 +22,3 @@ class CampViewMixin(object):
# Camp relation not found, or queryset is empty, return it unaltered
return queryset

View file

@ -2,12 +2,14 @@ from camps.models import Camp
from django.utils import timezone
from django.contrib import admin
def get_current_camp():
try:
return Camp.objects.get(camp__contains=timezone.now())
except Camp.DoesNotExist:
return False
class CampPropertyListFilter(admin.SimpleListFilter):
"""
SimpleListFilter to filter models by camp when camp is
@ -27,7 +29,6 @@ class CampPropertyListFilter(admin.SimpleListFilter):
for camp in unique_camps:
yield (camp.slug, camp.title)
def queryset(self, request, queryset):
# if self.value() is None return everything
if not self.value():
@ -45,4 +46,3 @@ class CampPropertyListFilter(admin.SimpleListFilter):
if item.camp != camp:
queryset = queryset.exclude(pk=item.pk)
return queryset