Friday fixes (#36)
* Monkey-patches a version of send_email that allows BCCs into the django accounts signup process. wtf, etc. * Adds alt-text to site header * Favicon.
This commit is contained in:
parent
5abf9ad3ab
commit
3118e4c11c
2 changed files with 39 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.mail import EmailMultiAlternatives
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
class MonkeyPatchMiddleware(object):
|
class MonkeyPatchMiddleware(object):
|
||||||
''' Ensures that our monkey patching only gets called after it is safe to do so.'''
|
''' Ensures that our monkey patching only gets called after it is safe to do so.'''
|
||||||
|
|
||||||
|
@ -7,6 +12,7 @@ class MonkeyPatchMiddleware(object):
|
||||||
|
|
||||||
def do_monkey_patch():
|
def do_monkey_patch():
|
||||||
patch_speaker_profile_form()
|
patch_speaker_profile_form()
|
||||||
|
patch_accounts_to_send_bcc()
|
||||||
|
|
||||||
# Remove this function from existence
|
# Remove this function from existence
|
||||||
global do_monkey_patch
|
global do_monkey_patch
|
||||||
|
@ -23,3 +29,30 @@ def patch_speaker_profile_form():
|
||||||
fields["biography"].widget = widgets.AceMarkdownEditor()
|
fields["biography"].widget = widgets.AceMarkdownEditor()
|
||||||
fields["experience"].widget = widgets.AceMarkdownEditor()
|
fields["experience"].widget = widgets.AceMarkdownEditor()
|
||||||
fields["accessibility"].widget = widgets.AceMarkdownEditor()
|
fields["accessibility"].widget = widgets.AceMarkdownEditor()
|
||||||
|
|
||||||
|
|
||||||
|
def patch_accounts_to_send_bcc():
|
||||||
|
''' Patches django-user-accounts' email functions to send a BCC e-mail to
|
||||||
|
the default BCC e-mail address. '''
|
||||||
|
|
||||||
|
from account import hooks
|
||||||
|
|
||||||
|
# django-user-accounts always uses send_mail like:
|
||||||
|
# send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, to)
|
||||||
|
|
||||||
|
if hasattr(settings, "ENVELOPE_BCC_LIST"):
|
||||||
|
bcc_email = settings.ENVELOPE_BCC_LIST
|
||||||
|
else:
|
||||||
|
bcc_email = None
|
||||||
|
|
||||||
|
def send_mail(subject, message, from_email, to):
|
||||||
|
email = EmailMultiAlternatives(
|
||||||
|
subject,
|
||||||
|
message,
|
||||||
|
from_email,
|
||||||
|
to,
|
||||||
|
bcc=bcc_email,
|
||||||
|
)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
hooks.send_mail = send_mail
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{% static 'lca2017/css/app.css' %}">
|
<link rel="stylesheet" href="{% static 'lca2017/css/app.css' %}">
|
||||||
<link rel="stylesheet" href="{% static 'lca2017/css/print.css' %}" media="print">
|
<link rel="stylesheet" href="{% static 'lca2017/css/print.css' %}" media="print">
|
||||||
|
<link rel="icon" href="{% static 'lca2017/images/favicon.ico' %}"
|
||||||
<!--FIXME: download-->
|
<!--FIXME: download-->
|
||||||
<link href="https://fonts.googleapis.com/css?family=Titillium+Web:700,900|Roboto:400italic,400,700,700italic" rel="stylesheet" type="text/css">
|
<link href="https://fonts.googleapis.com/css?family=Titillium+Web:700,900|Roboto:400italic,400,700,700italic" rel="stylesheet" type="text/css">
|
||||||
<!--Meta tags-->
|
<!--Meta tags-->
|
||||||
|
@ -47,9 +48,12 @@
|
||||||
<header role="banner" class="l-header">
|
<header role="banner" class="l-header">
|
||||||
<div class="l-header--logo">
|
<div class="l-header--logo">
|
||||||
{% block site_brand %}
|
{% block site_brand %}
|
||||||
<a href="/">
|
<a href="/"
|
||||||
|
title="linux.conf.au | 16–20 January, Hobart | The Future of Open Source"
|
||||||
|
>
|
||||||
<img src="{% static 'lca2017/images/svgs/lca2017-website-logo.svg' %}"
|
<img src="{% static 'lca2017/images/svgs/lca2017-website-logo.svg' %}"
|
||||||
width="100%"
|
width="100%"
|
||||||
|
title="linux.conf.au | 16–20 January, Hobart | The Future of Open Source"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue