minor tweaks
This commit is contained in:
parent
86ec617b71
commit
85a1db6704
|
@ -13,10 +13,14 @@ class CampRedirectView(CampViewMixin, View):
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
# find the closest camp in the past
|
# find the closest camp in the past
|
||||||
prevcamp = Camp.objects.filter(camp__endswith__lt=timezone.now()).order_by('-camp')[0]
|
prevcamp = Camp.objects.filter(
|
||||||
|
camp__endswith__lt=timezone.now()
|
||||||
|
).order_by('-camp')[0]
|
||||||
|
|
||||||
# find the closest upcoming camp
|
# find the closest upcoming camp
|
||||||
nextcamp = Camp.objects.filter(camp__startswith__gt=timezone.now()).order_by('camp')[0]
|
nextcamp = Camp.objects.filter(
|
||||||
|
camp__startswith__gt=timezone.now()
|
||||||
|
).order_by('camp')[0]
|
||||||
|
|
||||||
# find the number of days between the two camps
|
# find the number of days between the two camps
|
||||||
daysbetween = (nextcamp.camp.lower - prevcamp.camp.upper).days
|
daysbetween = (nextcamp.camp.lower - prevcamp.camp.upper).days
|
||||||
|
|
Loading…
Reference in a new issue