Commit f27082b9 authored by Luko van der Maas's avatar Luko van der Maas

Merge branch 'fix/gsuite-profile-option' into 'master'

Fix G Suite env variable and profile option

See merge request !1437

(cherry picked from commit c4bc7751)

ba9277a2 Fix G Suite env variable and profile option
parent 90af6188
......@@ -23,7 +23,7 @@ class MembershipInline(admin.StackedInline):
class ProfileInline(admin.StackedInline):
fields = ('starting_year', 'programme', 'address_street',
fields = ['starting_year', 'programme', 'address_street',
'address_street2', 'address_postal_code', 'address_city',
'address_country', 'student_number', 'phone_number',
'receive_optin', 'receive_newsletter', 'birthday',
......@@ -31,10 +31,16 @@ class ProfileInline(admin.StackedInline):
'nickname', 'display_name_preference', 'profile_description',
'website', 'photo', 'emergency_contact',
'emergency_contact_phone_number', 'language',
'event_permissions')
'event_permissions']
model = models.Profile
can_delete = False
def get_fields(self, request, obj=None):
fields = super().get_fields(request, obj)
if obj and obj.is_staff:
fields = fields + ['email_gsuite_only']
return fields
class MembershipTypeListFilter(admin.SimpleListFilter):
title = _('current membership type')
......
......@@ -19,9 +19,15 @@ class ProfileForm(forms.ModelForm):
'emergency_contact_phone_number', 'website',
'profile_description', 'nickname', 'initials',
'display_name_preference', 'photo', 'language',
'receive_optin', 'receive_newsletter']
'receive_optin', 'receive_newsletter', 'email_gsuite_only']
model = Profile
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not kwargs['instance'].user.is_staff:
self.fields['email_gsuite_only'].widget = self.fields[
'email_gsuite_only'].hidden_widget()
class UserCreationForm(BaseUserCreationForm):
"""
......
......@@ -54,7 +54,7 @@
</div>
{% for field in form %}
{% if forloop.counter < 8 %}
{% if forloop.counter < 9 %}
{% bootstrap_field field %}
{% endif %}
{% endfor %}
......@@ -62,7 +62,7 @@
<fieldset class="col-12 col-lg-6">
{% for field in form %}
{% if forloop.counter > 7 %}
{% if forloop.counter > 8 %}
{% bootstrap_field field %}
{% endif %}
{% endfor %}
......
......@@ -283,7 +283,7 @@ GSUITE_ADMIN_CREDENTIALS = json.loads(GSUITE_ADMIN_CREDENTIALS)
GSUITE_ADMIN_USER = os.environ.get('GSUITE_ADMIN_USER',
'concrexit-admin@thalia.nu')
GSUITE_DOMAIN = os.environ.get('GSUITE_DOMAIN', 'thalia.localhost')
GSUITE_MEMBERS_DOMAIN = os.environ.get('GSUITE_DOMAIN',
GSUITE_MEMBERS_DOMAIN = os.environ.get('GSUITE_MEMBERS_DOMAIN',
'members.thalia.localhost')
GSUITE_MEMBERS_AUTOSYNC = os.environ.get(
'GSUITE_MEMBERS_AUTOSYNC', False) == 'True'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment