1
0
mirror of https://github.com/fspc/workstand.git synced 2025-02-23 01:13:22 -05:00
* Check for api key before attempting to use api.

* Change to read-only so we still send data on edit.
This commit is contained in:
Drew Larson 2017-06-28 18:08:07 -06:00 committed by GitHub
parent 54f25a31f3
commit cf1f963e5d
4 changed files with 8 additions and 6 deletions

View File

@ -27,7 +27,7 @@ class MemberForm(ModelForm):
'involvement': CheckboxSelectMultiple(choices=Member.involvement_choices,
attrs={'class': 'mdl-checkbox__input'}),
'preferred_name': TextInput(attrs={'class': 'mdl-textfield__input'}),
'guardian_name': DateInput(attrs={'class': 'mdl-textfield__input', 'disabled': 'disabled'}),
'guardian_name': DateInput(attrs={'class': 'mdl-textfield__input', 'readonly': 'readonly'}),
'phone': TextInput(attrs={'class': 'mdl-textfield__input', 'pattern': '[0-9]*'}),
'street': TextInput(attrs={'class': 'mdl-textfield__input'}),
'city': TextInput(attrs={'class': 'mdl-textfield__input'}),

View File

@ -11,7 +11,7 @@ from registration.models import Member
@receiver(post_save, sender=Member, dispatch_uid='member.save_member')
def update_mailchimp(sender, instance, **kwargs):
if instance.email:
if instance.email and settings.MAILCHIMP_API_KEY:
involvement = {id: True for id in instance.involvement}
client = MailChimp(settings.MAILCHIMP_USERNAME, settings.MAILCHIMP_API_KEY)
try:

View File

@ -16,11 +16,12 @@
'YYYY/MM/DD', 'YY/MM/DD', 'DD/MM/YY', 'DD/MM/YYYY']);
if (dob.add(threshold).isAfter(moment())) {
document.getElementById('{{ form.guardian_name.id_for_label }}').disabled = false;
document.getElementById('{{ form.guardian_name.id_for_label }}').readOnly = false;
document.getElementById('{{ form.guardian_name.id_for_label }}').required = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').parentNode.classList.remove('is-disabled');
document.getElementById('{{ form.guardian_name.id_for_label }}').focus();
} else {
document.getElementById('{{ form.guardian_name.id_for_label }}').disabled = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').readOnly = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').parentNode.classList.add('is-disabled');
}
});

View File

@ -15,11 +15,12 @@
'YYYY/MM/DD', 'YY/MM/DD', 'DD/MM/YY', 'DD/MM/YYYY']);
if (dob.add(threshold).isAfter(moment())) {
document.getElementById('{{ form.guardian_name.id_for_label }}').disabled = false;
document.getElementById('{{ form.guardian_name.id_for_label }}').readOnly = false;
document.getElementById('{{ form.guardian_name.id_for_label }}').required = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').parentNode.classList.remove('is-disabled');
document.getElementById('{{ form.guardian_name.id_for_label }}').focus();
} else {
document.getElementById('{{ form.guardian_name.id_for_label }}').disabled = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').readOnly = true;
document.getElementById('{{ form.guardian_name.id_for_label }}').parentNode.classList.add('is-disabled');
}
});