readd middleware with the 1.10 setting

This commit is contained in:
Thomas Steen Rasmussen 2017-01-31 23:26:45 +01:00
parent c047506d26
commit dcbf9b6992
3 changed files with 12 additions and 2 deletions

View file

@ -50,6 +50,7 @@ BANKACCOUNT_IBAN='123'
BANKACCOUNT_SWIFTBIC='123'
BANKACCOUNT_REG='123'
BANKACCOUNT_ACCOUNT='123'
TICKET_CATEGORY_NAME='Tickets'
# schedule settings
SCHEDULE_MIDNIGHT_OFFSET_HOURS=6

View file

@ -96,11 +96,20 @@ BOOTSTRAP3 = {
'jquery_url': '/static/js/jquery.min.js',
'javascript_url': '/static/js/bootstrap.min.js'
}
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS += ['debug_toolbar', ]
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware']
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware']
LOGGING = {
'version': 1,

View file

@ -16,7 +16,7 @@ def current_order(request):
def user_has_tickets(request):
has_tickets = False
if hasattr(request.user, 'orders') and request.user.orders.filter(
tickets__product__category__pk=settings.TICKET_CATEGORY_ID
tickets__product__category__name=settings.TICKET_CATEGORY_NAME
).exists():
has_tickets = True
return {'has_tickets': has_tickets}