Propagate setting and add organizer display settings page

This commit is contained in:
Raphael Michel
2017-10-06 13:07:16 +02:00
parent 28d074366e
commit bbd112280a
7 changed files with 139 additions and 31 deletions

View File

@@ -9,6 +9,7 @@ from pretix.base.forms import I18nModelForm, SettingsForm
from pretix.base.models import Organizer, Team
from pretix.control.forms import ExtFileField
from pretix.multidomain.models import KnownDomain
from pretix.presale.style import get_fonts
class OrganizerForm(I18nModelForm):
@@ -114,14 +115,16 @@ class TeamForm(forms.ModelForm):
class OrganizerSettingsForm(SettingsForm):
locales = forms.MultipleChoiceField(
choices=settings.LANGUAGES,
label=_("Use languages"),
widget=forms.CheckboxSelectMultiple,
help_text=_('Choose all languages that your organizer homepage should be available in.')
organizer_info_text = I18nFormField(
label=_('Info text'),
required=False,
widget=I18nTextarea,
help_text=_('Not displayed anywhere by default, but if you want to, you can use this e.g. in ticket templates.')
)
organizer_primary_color = forms.CharField(
class OrganizerDisplaySettingsForm(SettingsForm):
primary_color = forms.CharField(
label=_("Primary color"),
required=False,
validators=[
@@ -130,21 +133,12 @@ class OrganizerSettingsForm(SettingsForm):
],
widget=forms.TextInput(attrs={'class': 'colorpickerfield'})
)
organizer_homepage_text = I18nFormField(
label=_('Homepage text'),
required=False,
widget=I18nTextarea,
help_text=_('This will be displayed on the organizer homepage.')
)
organizer_info_text = I18nFormField(
label=_('Info text'),
required=False,
widget=I18nTextarea,
help_text=_('Not displayed anywhere by default, but if you want to, you can use this e.g. in ticket templates.')
)
organizer_logo_image = ExtFileField(
label=_('Logo image'),
ext_whitelist=(".png", ".jpg", ".gif", ".jpeg"),
@@ -152,7 +146,6 @@ class OrganizerSettingsForm(SettingsForm):
help_text=_('If you provide a logo image, we will by default not show your organization name '
'in the page header. We will show your logo with a maximal height of 120 pixels.')
)
event_list_type = forms.ChoiceField(
label=_('Default overview style'),
choices=(
@@ -160,3 +153,22 @@ class OrganizerSettingsForm(SettingsForm):
('calendar', _('Calendar'))
)
)
locales = forms.MultipleChoiceField(
choices=settings.LANGUAGES,
label=_("Use languages"),
widget=forms.CheckboxSelectMultiple,
help_text=_('Choose all languages that your organizer homepage should be available in.')
)
primary_font = forms.ChoiceField(
label=_('Font'),
choices=[
('Open Sans', 'Open Sans')
],
help_text=_('Only respected by modern browsers.')
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['primary_font'].choices += [
(a, a) for a in get_fonts()
]