Fixed case law access request email

This commit is contained in:
Zakary Timson 2018-01-23 20:42:21 -05:00
parent 176f9d7fb3
commit 86ede38629

View File

@ -55,7 +55,7 @@ def login(request):
if request.POST.get('caselaw'): if request.POST.get('caselaw'):
perm = Permission.objects.get(codename='change_user') perm = Permission.objects.get(codename='change_user')
admins = User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm) | Q(is_superuser=True)).distinct().values_list('email', flat=True) admins = User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm) | Q(is_superuser=True)).distinct().values_list('email', flat=True)
mail.send_mail('OACPL Case Law Request', '{} {} ({}) has requested access to case law'.format(user.first_name, user.last_name, user.email), settings.EMAIL_HOST_USER, admins, html_message=render_to_string('email.html', {'content': '<a href="#">%(email)s</a> has requested case law access.', 'base_url': settings.BASE_URL})) mail.send_mail('OACPL Case Law Request', '{} {} ({}) has requested access to case law'.format(user.first_name, user.last_name, user.email), settings.EMAIL_HOST_USER, admins, html_message=render_to_string('email.html', {'content': '{} {} ({}) has requested access to case law'.format(user.first_name, user.last_name, user.email), 'base_url': settings.BASE_URL}))
auth.login(request, user) auth.login(request, user)
return redirect('/') return redirect('/')
else: else: