Lowered target python version to 3.4
This commit is contained in:
parent
98acaee04f
commit
12119cb514
@ -23,8 +23,8 @@ def contact(request):
|
||||
|
||||
result = False
|
||||
if name is not None and email is not None and subject is not None and body is not None:
|
||||
result = mail.send_mail(f'OACPL CONTACT: {subject}', body, settings.EMAIL_HOST_USER, [settings.EMAIL_CONTACT],
|
||||
html_message=f'<strong>From:</strong> {name} ({email})<br><br>{body}')
|
||||
result = mail.send_mail('OACPL CONTACT: %(subject)s' % locals(), body, settings.EMAIL_HOST_USER, [settings.EMAIL_CONTACT],
|
||||
html_message='<strong>From:</strong> %(name)s (%(email)s)<br><br>{body}' % locals())
|
||||
|
||||
return JsonResponse({'success': True if result else False})
|
||||
|
||||
@ -51,7 +51,7 @@ def login(request):
|
||||
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)
|
||||
print(admins)
|
||||
mail.send_mail('OACPL Case Law Request', f'{user.email} has requested case law access.', settings.EMAIL_HOST_USER, admins, html_message=f'<a href="#">{user.email}</a> has requested case law access.')
|
||||
mail.send_mail('OACPL Case Law Request', '%(user.email)s has requested case law access.', settings.EMAIL_HOST_USER, admins, html_message='<a href="#">%(user.email)s</a> has requested case law access.')
|
||||
auth.login(request, user)
|
||||
return redirect('/')
|
||||
else:
|
||||
|
@ -14,10 +14,10 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
newsletters = Newsletter.objects.filter(Q(sent=False) & Q(publish__lte=timezone.now()))
|
||||
subscribers = Subscriber.objects.all().values_list('email', flat=True)
|
||||
print(f'Found {len(newsletters)} unsent newsletters')
|
||||
print(f'Found {len(subscribers)} subscribers')
|
||||
print('Found %s unsent newsletters' % len(newsletters))
|
||||
print('Found %s subscribers' % len(subscribers))
|
||||
for newsletter in newsletters:
|
||||
print(f'Sending newsletter: "{newsletter.subject}"')
|
||||
print('Sending newsletter: "$s"' % newsletter.subject)
|
||||
mail.send_mail(newsletter.subject, strip_tags(newsletter.body), settings.EMAIL_HOST_USER, subscribers, html_message=newsletter.body)
|
||||
newsletter.sent = True
|
||||
newsletter.save()
|
||||
|
Loading…
Reference in New Issue
Block a user