minor tweaks

This commit is contained in:
Stephan Telling 2017-08-17 21:16:49 +02:00
parent 86ec617b71
commit 85a1db6704
No known key found for this signature in database
GPG key ID: D4892289F36ADA9B

View file

@ -13,10 +13,14 @@ class CampRedirectView(CampViewMixin, View):
def dispatch(self, request, *args, **kwargs):
# 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
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
daysbetween = (nextcamp.camp.lower - prevcamp.camp.upper).days