1 from __future__ import unicode_literals
3 from django.conf import settings
4 from django.core.exceptions import ImproperlyConfigured
7 if not (getattr(settings, "SITE_ID") and
8 "django.contrib.sites" in settings.INSTALLED_APPS):
9 raise ImproperlyConfigured("django.contrib.sites is required")
12 # The maximum allowed length for field values.
13 FIELD_MAX_LENGTH = getattr(settings, "FORMS_BUILDER_FIELD_MAX_LENGTH", 2000)
15 # The maximum allowed length for field labels.
16 LABEL_MAX_LENGTH = getattr(settings, "FORMS_BUILDER_LABEL_MAX_LENGTH", 200)
18 # Sequence of custom fields that will be added to the form field types.
19 EXTRA_FIELDS = getattr(settings, "FORMS_BUILDER_EXTRA_FIELDS", ())
21 # Sequence of custom widgets that will add/update form fields widgets.
22 EXTRA_WIDGETS = getattr(settings, "FORMS_BUILDER_EXTRA_WIDGETS", ())
24 # The absolute path where files will be uploaded to.
25 UPLOAD_ROOT = getattr(settings, "FORMS_BUILDER_UPLOAD_ROOT", None)
27 # Boolean controlling whether HTML5 form fields are used.
28 USE_HTML5 = getattr(settings, "FORMS_BUILDER_USE_HTML5", True)
30 # Boolean controlling whether forms are associated to Django's Sites framework.
31 USE_SITES = getattr(settings, "FORMS_BUILDER_USE_SITES", False)
33 # Boolean controlling whether form slugs are editable in the admin.
34 EDITABLE_SLUGS = getattr(settings, "FORMS_BUILDER_EDITABLE_SLUGS", False)
36 # Char to start a quoted choice with.
37 CHOICES_QUOTE = getattr(settings, "FORMS_BUILDER_CHOICES_QUOTE", "`")
39 # Char to end a quoted choice with.
40 CHOICES_UNQUOTE = getattr(settings, "FORMS_BUILDER_CHOICES_UNQUOTE", "`")
42 # Char to use as a field delimiter when exporting form responses as CSV.
43 CSV_DELIMITER = getattr(settings, "FORMS_BUILDER_CSV_DELIMITER", ",")
45 # The maximum allowed length for field help text
46 HELPTEXT_MAX_LENGTH = getattr(settings, "FORMS_BUILDER_HELPTEXT_MAX_LENGTH", 100)
48 # The maximum allowed length for field choices
49 CHOICES_MAX_LENGTH = getattr(settings, "FORMS_BUILDER_CHOICES_MAX_LENGTH", 1000)
51 # Does sending emails fail silently or raise an exception.
52 EMAIL_FAIL_SILENTLY = getattr(settings, "FORMS_BUILDER_EMAIL_FAIL_SILENTLY",
55 # Django SITE_ID - need a default since no longer provided in settings.py.
56 SITE_ID = getattr(settings, "SITE_ID", 1)