2016-05-30 22:58:11 +00:00
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
|
2016-05-14 17:39:34 +00:00
|
|
|
def current_order(request):
|
|
|
|
if request.user.is_authenticated():
|
|
|
|
order = None
|
2016-05-15 22:09:00 +00:00
|
|
|
orders = request.user.orders.filter(open__isnull=False)
|
2016-05-14 17:39:34 +00:00
|
|
|
|
|
|
|
if orders:
|
|
|
|
order = orders[0]
|
|
|
|
|
|
|
|
return {'current_order': order}
|
|
|
|
return {}
|
|
|
|
|
|
|
|
|
2016-05-30 22:58:11 +00:00
|
|
|
def user_has_tickets(request):
|
|
|
|
has_tickets = False
|
2016-05-31 08:58:52 +00:00
|
|
|
if hasattr(request.user, 'orders') and request.user.orders.filter(
|
2017-01-31 22:26:45 +00:00
|
|
|
tickets__product__category__name=settings.TICKET_CATEGORY_NAME
|
2016-05-30 22:58:11 +00:00
|
|
|
).exists():
|
|
|
|
has_tickets = True
|
|
|
|
return {'has_tickets': has_tickets}
|
2016-12-25 14:52:55 +00:00
|
|
|
|