cleanup in camps/
This commit is contained in:
parent
d20a964793
commit
aaa4df27db
|
@ -1,6 +1,4 @@
|
|||
from django.conf import settings
|
||||
from .models import Camp
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
def camp(request):
|
||||
|
|
|
@ -22,5 +22,3 @@ class CampViewMixin(object):
|
|||
|
||||
# Camp relation not found, or queryset is empty, return it unaltered
|
||||
return queryset
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue