Seperated some config settings from code.
This commit is contained in:
@@ -4,6 +4,7 @@ import datetime
|
||||
import logging
|
||||
from babel.dates import format_date
|
||||
from django import forms
|
||||
from django.apps import apps
|
||||
from django.utils.translation import get_language, ugettext, ugettext_lazy as _
|
||||
from django_countries.fields import LazyTypedChoiceField
|
||||
from datetimewidget.widgets import DateWidget, TimeWidget, DateTimeWidget
|
||||
@@ -13,8 +14,8 @@ from .. import config
|
||||
from .. import models
|
||||
from .generic import ChainedForm
|
||||
|
||||
app_config = apps.get_containing_app_config(__package__)
|
||||
logger = logging.getLogger(__name__)
|
||||
DEVELOPMENT_INIT_FORMS = False
|
||||
|
||||
|
||||
class EventUpdateForm(forms.ModelForm):
|
||||
@@ -207,7 +208,7 @@ class LocationForm(EventCreateForm):
|
||||
elif sport == 'W':
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Maikammer, Pfalz'
|
||||
|
||||
if DEVELOPMENT_INIT_FORMS:
|
||||
if app_config.settings.development_init_forms:
|
||||
self.fields['location'].initial = self.fields['location'].widget.attrs['placeholder']
|
||||
|
||||
|
||||
@@ -478,7 +479,7 @@ class DescriptionForm(EventCreateForm):
|
||||
elif sport == 'W' and not last_day:
|
||||
title_prefix += u'%s ' % ugettext(u'Tageswanderung')
|
||||
|
||||
if DEVELOPMENT_INIT_FORMS:
|
||||
if app_config.settings.development_init_forms:
|
||||
if not title_prefix:
|
||||
title_prefix = u'%s' % choices.SPORT_CHOICES.get_label(sport)
|
||||
|
||||
@@ -609,7 +610,7 @@ class TrainerForm(EventCreateForm):
|
||||
self.fields['trainer_firstname'].initial = self._request.user.first_name
|
||||
self.fields['trainer_familyname'].initial = self._request.user.last_name
|
||||
self.fields['trainer_email'].initial = self._request.user.email
|
||||
elif DEVELOPMENT_INIT_FORMS:
|
||||
elif app_config.settings.development_init_forms:
|
||||
self.fields['trainer_firstname'].initial = self.fields['trainer_firstname'].widget.attrs['placeholder']
|
||||
self.fields['trainer_familyname'].initial = self.fields['trainer_familyname'].widget.attrs['placeholder']
|
||||
self.fields['trainer_email'].initial = self.fields['trainer_email'].widget.attrs['placeholder']
|
||||
@@ -712,7 +713,7 @@ class ChargesForm(EventCreateForm):
|
||||
else:
|
||||
n_pre_meetings = 0
|
||||
|
||||
fees = config.FEE_MATRIX[charge_key]
|
||||
fees = app_config.settings.fee_matrix[charge_key]
|
||||
|
||||
trainer_reward = (
|
||||
fees['trainer_fee']
|
||||
|
||||
Reference in New Issue
Block a user