Permalink
Browse files

Merge pull request #2 from Raumkraut/master

Merge Raumkraut's updates
  • Loading branch information...
2 parents aa9ed6a + 6140a6e commit 9d7b810ebe6960b07da73e47aad01f669c38f2a6 @evildmp evildmp committed Mar 26, 2013
View
1 .gitignore
@@ -2,4 +2,5 @@
.*
dist
MANIFEST
+*.egg-info
View
2 MANIFEST.in
@@ -1,5 +1,5 @@
include AUTHORS
-include README.md
+include README.rst
include LICENSE
recursive-include form_designer/templates *.html *.txt
recursive-include form_designer/static *.js
View
9 README.rst
@@ -24,7 +24,7 @@ This install guide assumes that you are familiar with Python and Django.
- Install the module using pip::
- $ pip install git://github.com/philomat/django-form-designer.git#egg=django-form-designer
+ $ pip install git+git://github.com/philomat/django-form-designer.git#egg=django-form-designer
**or** download it from http://github.com/philomat/django-form-designer, and run the installation
script::
@@ -89,6 +89,13 @@ Using Django Form Designer with Django CMS
'form_designer.contrib.cms_plugins.form_designer_form',
)
+- Optionally add ``form_designer.middleware.RedirectMiddleware to MIDDLEWARE_CLASSES to handle redirects::
+
+ MIDDLEWARE_CLASSES = (
+ ...
+ 'form_designer.middleware.RedirectMiddleware',
+ )
+
- Set up the database tables using::
$ manage.py syncdb
View
2 form_designer/admin.py
@@ -28,7 +28,7 @@ class FormDefinitionFieldInline(admin.StackedInline):
class FormDefinitionAdmin(admin.ModelAdmin):
fieldsets = [
(_('Basic'), {'fields': ['name', 'require_hash', 'method', 'action', 'title', 'body']}),
- (_('Settings'), {'fields': ['allow_get_initial', 'log_data', 'success_redirect', 'success_clear', 'display_logged', 'save_uploaded_files'], 'classes': ['collapse']}),
+ (_('Settings'), {'fields': ['allow_get_initial', 'log_data', 'success_redirect', 'redirection_url', 'success_clear', 'display_logged', 'save_uploaded_files'], 'classes': ['collapse']}),
(_('Mail form'), {'fields': ['mail_to', 'mail_from', 'mail_subject', 'mail_uploaded_files'], 'classes': ['collapse']}),
(_('Templates'), {'fields': ['message_template', 'form_template_name'], 'classes': ['collapse']}),
(_('Messages'), {'fields': ['success_message', 'error_message', 'submit_label'], 'classes': ['collapse']}),
View
11 form_designer/contrib/cms_plugins/form_designer_form/cms_plugins.py
@@ -1,10 +1,13 @@
from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition
+from form_designer.exceptions import HttpRedirectException
from form_designer.views import process_form
from form_designer import settings
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
+from django.conf import settings as django_settings
+from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
@@ -20,8 +23,12 @@ def render(self, context, instance, placeholder):
else:
self.render_template = settings.DEFAULT_FORM_TEMPLATE
- # Redirection does not work with CMS plugin, hence disable:
- return process_form(context['request'], instance.form_definition, context, disable_redirection=True)
+ disable_redirection = 'form_designer.middleware.RedirectMiddleware' not in django_settings.MIDDLEWARE_CLASSES
+ response = process_form(context['request'], instance.form_definition, context, disable_redirection=disable_redirection)
+ if isinstance(response, HttpResponseRedirect):
+ raise HttpRedirectException(response, "Redirect")
+ return response
+
def icon_src(self, instance):
return "/static/plugin_icons/form.png"
View
4 form_designer/exceptions.py
@@ -0,0 +1,4 @@
+class HttpRedirectException(Exception):
+ def __init__(self, response, *args, **kwargs):
+ self.response = response
+ super(HttpRedirectException, self).__init__(*args, **kwargs)
View
4 form_designer/forms.py
@@ -1,5 +1,3 @@
-import os
-
from django import forms
from django.forms import widgets
from django.conf import settings as django_settings
@@ -69,6 +67,6 @@ def _media(self):
else:
plugins = ['js/jquery.js'] + plugins
js.extend(
- [os.path.join(settings.STATIC_URL, path) for path in plugins])
+ ['/'.join((settings.STATIC_URL, path)) for path in plugins])
return forms.Media(js=js)
media = property(_media)
View
BIN form_designer/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
View
100 form_designer/locale/fr/LC_MESSAGES/django.po
@@ -7,31 +7,34 @@ msgstr ""
"Project-Id-Version: 1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-01-19 20:56-0500\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: SIMON CHARETTE <scharette@reptiletech.com>\n"
+"PO-Revision-Date: 2012-12-07 19:43+0100\n"
+"Last-Translator: David Marclay <david.marclay@reason-systems.com>\n"
"Language-Team: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
-#: admin.py:27 admin.py:38
+#: admin.py:27
+#: admin.py:38
msgid "Basic"
msgstr "Base"
#: admin.py:28
msgid "Display"
msgstr "Affichage"
-#: admin.py:29 settings.py:10
+#: admin.py:29
+#: settings.py:10
msgid "Text"
msgstr "Texte"
#: admin.py:30
msgid "Numbers"
msgstr "Nombres"
-#: admin.py:31 settings.py:23
+#: admin.py:31
+#: settings.py:23
msgid "Regex"
msgstr "Expression régulière"
@@ -59,20 +62,28 @@ msgstr "Gabarits"
msgid "Messages"
msgstr "Messages"
-#: admin.py:63 admin.py:102 admin.py:147 models.py:60 models.py:173
+#: admin.py:63
+#: admin.py:102
+#: admin.py:147
+#: models.py:60
+#: models.py:173
#: contrib/cms_plugins/form_designer_form/cms_plugins.py:14
msgid "Form"
msgstr "Formulaire"
-#: admin.py:78 models.py:174
+#: admin.py:78
+#: models.py:174
msgid "Data"
msgstr "Données"
-#: admin.py:104 admin.py:149 models.py:172
+#: admin.py:104
+#: admin.py:149
+#: models.py:172
msgid "Created"
msgstr "Créé"
-#: admin.py:106 admin.py:151
+#: admin.py:106
+#: admin.py:151
msgid "ID"
msgstr "ID"
@@ -102,7 +113,8 @@ msgstr "Ce type de champ necessite une expression régulière."
msgid "This field class requires a model."
msgstr "Cette classe de champ nécessite un modèle."
-#: models.py:35 models.py:187
+#: models.py:35
+#: models.py:187
msgid "name"
msgstr "Nom"
@@ -112,9 +124,7 @@ msgstr "Obscurcir l'URL vers ce formulaire"
#: models.py:36
msgid "If enabled, the form can only be reached via a secret URL."
-msgstr ""
-"Si activé, il sera seulement possible d'atteindre le formulaire via une URL "
-"secrète."
+msgstr "Si activé, il sera seulement possible d'atteindre le formulaire via une URL secrète."
#: models.py:39
msgid "title"
@@ -129,17 +139,8 @@ msgid "target URL"
msgstr "URL cible"
#: models.py:41
-msgid ""
-"If you leave this empty, the page where the form resides will be requested, "
-"and you can use the mail form and logging features. You can also send data "
-"to external sites: For instance, enter \"http://www.google.ch/search\" to "
-"create a search form."
-msgstr ""
-"Si vous laisser ce champs vide, le formulaire sera envoyé vers la page où il "
-"se trouve et vous pourrez utiliser les fonctionnalités de courriel et de "
-"sauvegarde. Vous pouvez aussi envoyer les données saisies vers un site "
-"externe: Par exemple, entrez \"http://www.google.fr/search\" pour créer un "
-"formulaire de recherche."
+msgid "If you leave this empty, the page where the form resides will be requested, and you can use the mail form and logging features. You can also send data to external sites: For instance, enter \"http://www.google.ch/search\" to create a search form."
+msgstr "Si vous laisser ce champs vide, le formulaire sera envoyé vers la page où il se trouve et vous pourrez utiliser les fonctionnalités de courriel et de sauvegarde. Vous pouvez aussi envoyer les données saisies vers un site externe: Par exemple, entrez \"http://www.google.fr/search\" pour créer un formulaire de recherche."
#: models.py:42
msgid "send form data to e-mail address"
@@ -155,7 +156,7 @@ msgstr "Sujet du courriel"
#: models.py:45
msgid "Send uploaded files as email attachments"
-msgstr "Joindre les fichiers téléversés aux courriels."
+msgstr "Joindre les fichiers téléversés aux courriels"
#: models.py:46
msgid "method"
@@ -187,9 +188,7 @@ msgstr "Sauver les fichiers téléversés"
#: models.py:51
msgid "Saves all uploaded files using server storage."
-msgstr ""
-"Sauve tous les fichiers téléversés en utilisant la mécanique de stockage du "
-"serveur."
+msgstr "Sauve tous les fichiers téléversés en utilisant la mécanique de stockage du serveur."
#: models.py:52
msgid "HTTP redirect after successful submission"
@@ -204,31 +203,16 @@ msgid "allow initial values via URL"
msgstr "Permettre l'assignation de valeurs via l'URL"
#: models.py:54
-msgid ""
-"If enabled, you can fill in form fields by adding them to the query string."
-msgstr ""
-"Si activé, vous pouvez populer les champs du formulaire en les ajoutants à "
-"la chaîne de requête: Par exemple \"http://chemin.vers/mon/formulaire?"
-"prenom=Serge"
+msgid "If enabled, you can fill in form fields by adding them to the query string."
+msgstr "Si activé, vous pouvez préremplir les champs du formulaire en les ajoutants à la chaîne de requête: Par exemple \"http://chemin.vers/mon/formulaire?prenom=Serge"
#: models.py:55
msgid "message template"
msgstr "Gabarit de message de courriel"
#: models.py:55
-msgid ""
-"Your form fields are available as template context. Example: \"{{ message }}"
-"\" if you have a field named `message`. To iterate over all fields, use the "
-"variable `data` (a list containing a dictionary for each form field, each "
-"containing the elements `name`, `label`, `value`)."
-msgstr ""
-"Vos champs de formulaire sont accessibles sous forme de variables de "
-"gabarits.Par exemple: \"{{ message }}\" si vous avez un champ nommé &laquo;"
-"&thinsp;message&thinsp;&raquo;.Pour itérer sur l'ensemble des champs, "
-"utilisez la variables &laquo;&thinsp;data&thinsp;&raquo; (&thinsp;une liste "
-"de dictionnaires associé à chaque champ avec les clefs &laquo;&thinsp;"
-"name&thinsp;&raquo;, &laquo;&thinsp;label&thinsp;&raquo;, &laquo;&thinsp;"
-"value&thinsp;&raquo;&thinsp;)"
+msgid "Your form fields are available as template context. Example: \"{{ message }}\" if you have a field named `message`. To iterate over all fields, use the variable `data` (a list containing a dictionary for each form field, each containing the elements `name`, `label`, `value`)."
+msgstr "Vos champs de formulaire sont accessibles sous forme de variables de gabarits.Par exemple: \"{{ message }}\" si vous avez un champ nommé &laquo;&thinsp;message&thinsp;&raquo;.Pour itérer sur l'ensemble des champs, utilisez la variables &laquo;&thinsp;data&thinsp;&raquo; (&thinsp;une liste de dictionnaires associé à chaque champ avec les clefs &laquo;&thinsp;name&thinsp;&raquo;, &laquo;&thinsp;label&thinsp;&raquo;, &laquo;&thinsp;value&thinsp;&raquo;&thinsp;)"
#: models.py:56
msgid "form template"
@@ -304,23 +288,23 @@ msgstr "Un libellé par ligne"
#: models.py:198
msgid "max. length"
-msgstr "Longueur maximale"
+msgstr "Longueur max."
#: models.py:199
msgid "min. length"
-msgstr "Longueur minimale"
+msgstr "Longueur min."
#: models.py:200
msgid "max. value"
-msgstr "Valeur maximale"
+msgstr "Valeur max."
#: models.py:201
msgid "min. value"
-msgstr "Valeur minimale"
+msgstr "Valeur min."
#: models.py:202
msgid "max. digits"
-msgstr "Nombre de chiffres maximum"
+msgstr "Nombre de chiffres max."
#: models.py:203
msgid "decimal places"
@@ -398,9 +382,10 @@ msgstr "Choix Multiple de Modèle"
msgid "File"
msgstr "Fichier"
-#: settings.py:29 settings.py:37
+#: settings.py:29
+#: settings.py:37
msgid "Default"
-msgstr "Défaut"
+msgstr "Par défaut"
#: settings.py:30
msgid "Text area"
@@ -440,16 +425,16 @@ msgstr "implémentation personnalisée"
#: uploads.py:20
msgid "This field is required."
-msgstr "Cette classe de champ nécessite un modèle."
+msgstr "Ce champs est obligatoire."
#: uploads.py:25
msgid "This file type is not allowed."
-msgstr ""
+msgstr "Le type de fichier n'est pas autorisé."
#: uploads.py:27
#, python-format
msgid "Please keep file size under %(max_size)s. Current size is %(size)s."
-msgstr ""
+msgstr "Merci de ne pas dépasser la taille maximale de %(max_size)s. Taille actuelle : %(size)s."
#: views.py:21
msgid "Thank you, the data was submitted successfully."
@@ -486,3 +471,4 @@ msgstr "oui"
#: templatetags/friendly.py:18
msgid "no"
msgstr "non"
+
View
BIN form_designer/locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
View
241 form_designer/locale/nl/LC_MESSAGES/django.po
@@ -2,126 +2,111 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-01-19 20:56-0500\n"
+"POT-Creation-Date: 2012-07-19 16:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Erik Romijn <erik@erik.io>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: admin.py:27 admin.py:38
+#: admin.py:18 admin.py:30
msgid "Basic"
msgstr "Basis"
-#: admin.py:28
+#: admin.py:19
msgid "Display"
msgstr "Weergave"
-#: admin.py:29 settings.py:10
+#: admin.py:20 settings.py:10
msgid "Text"
msgstr "Tekst"
-#: admin.py:30
+#: admin.py:21
msgid "Numbers"
msgstr "Nummers"
-#: admin.py:31 settings.py:23
+#: admin.py:22 settings.py:23
msgid "Regex"
msgstr "Reguliere expressie"
-#: admin.py:32
+#: admin.py:23
msgid "Choices"
msgstr "Keuzes"
-#: admin.py:33
+#: admin.py:24
msgid "Model Choices"
msgstr "Model-keuzes"
-#: admin.py:39
+#: admin.py:31
msgid "Settings"
msgstr ""
-#: admin.py:40
+#: admin.py:32
msgid "Mail form"
msgstr "Mail-formulier"
-#: admin.py:41
+#: admin.py:33
msgid "Templates"
msgstr "Sjablonen"
-#: admin.py:42
+#: admin.py:34
msgid "Messages"
msgstr "Berichten"
-#: admin.py:63 admin.py:102 admin.py:147 models.py:60 models.py:173
+#: admin.py:63
+#, fuzzy, python-format
+msgid "Export selected %%(verbose_name_plural)s as %s"
+msgstr "Exporteer geselecteerde %(verbose_name_plural) als CSV"
+
+#: admin.py:73 models.py:55
#: contrib/cms_plugins/form_designer_form/cms_plugins.py:14
+#: contrib/exporters/__init__.py:58
msgid "Form"
msgstr "Formulier"
-#: admin.py:78 models.py:174
+#: admin.py:84
msgid "Data"
msgstr "Data"
-#: admin.py:104 admin.py:149 models.py:172
-msgid "Created"
-msgstr "Aangemaakt"
-
-#: admin.py:106 admin.py:151
-msgid "ID"
-msgstr "ID"
-
-#: admin.py:125
-#, fuzzy, python-format
-msgid "Export selected %(verbose_name_plural)s as CSV"
-msgstr "Exporteer geselecteerde %(verbose_name_plural) als CSV"
-
-#: admin.py:173
-#, fuzzy, python-format
-msgid "Export selected %(verbose_name_plural)s as XLS"
-msgstr "Exporteer geselecteerde %(verbose_name_plural) als Excel XLS"
-
-#: admin.py:185
-msgid "CSV export is not enabled."
-msgstr "CSV-exporteren is niet geäctiveerd."
-
-#: admin.py:190
-msgid "XLS export is not enabled."
-msgstr "XLS-exporteren is niet geäctiveerd."
+#: admin.py:108
+#, python-format
+msgid "Export view as %s"
+msgstr ""
-#: forms.py:43
+#: forms.py:44
msgid "This field class requires a regular expression."
-msgstr "Deze veldklasse vereist een model."
+msgstr "Deze veldklasse vereist een reguliere expressie."
-#: forms.py:48
+#: forms.py:49
msgid "This field class requires a model."
msgstr "Deze veldklasse vereist een model."
-#: models.py:35 models.py:187
+#: models.py:30 models.py:180
msgid "name"
msgstr "Naam"
-#: models.py:36
+#: models.py:31
msgid "obfuscate URL to this form"
msgstr ""
-#: models.py:36
+#: models.py:31
msgid "If enabled, the form can only be reached via a secret URL."
msgstr ""
-#: models.py:39
+#: models.py:34
msgid "title"
msgstr "Titel"
-#: models.py:40
+#: models.py:35
msgid "body"
msgstr ""
-#: models.py:41
+#: models.py:36
msgid "target URL"
msgstr "Doel-URL"
-#: models.py:41
+#: models.py:36
msgid ""
"If you leave this empty, the page where the form resides will be requested, "
"and you can use the mail form and logging features. You can also send data "
@@ -133,78 +118,78 @@ msgstr ""
"naar externe sites versturen. Bijvoorbeeld, voer \"http://www.google.com/"
"search\" in om een zoekformulier aan te maken. "
-#: models.py:42
+#: models.py:37
msgid "send form data to e-mail address"
msgstr "Formuliergegevens naar e-mail-adres sturen"
-#: models.py:43
+#: models.py:38
msgid "sender address"
msgstr "Afzender-adres"
-#: models.py:44
+#: models.py:39
msgid "email subject"
msgstr "E-mail-onderwerp"
-#: models.py:45
+#: models.py:40
msgid "Send uploaded files as email attachments"
msgstr ""
-#: models.py:46
+#: models.py:41
msgid "method"
msgstr "Methode"
-#: models.py:47
+#: models.py:42
msgid "success message"
msgstr "Successmelding"
-#: models.py:48
+#: models.py:43
msgid "error message"
msgstr "Foutmelding"
-#: models.py:49
+#: models.py:44
msgid "submit button label"
msgstr "Label voor de verzendknop"
-#: models.py:50
+#: models.py:45
msgid "log form data"
msgstr "Formulierdata loggen"
-#: models.py:50
+#: models.py:45
msgid "Logs all form submissions to the database."
msgstr "Log alle formulierinsturingen in de database."
-#: models.py:51
+#: models.py:46
msgid "save uploaded files"
msgstr ""
-#: models.py:51
+#: models.py:46
msgid "Saves all uploaded files using server storage."
msgstr ""
-#: models.py:52
+#: models.py:47
msgid "HTTP redirect after successful submission"
msgstr "Doorsturen na success"
-#: models.py:53
+#: models.py:48
msgid "clear form after successful submission"
msgstr "Na succesvol versturen formulier leegmaken"
-#: models.py:54
+#: models.py:49
msgid "allow initial values via URL"
msgstr "Initiële waarden via de URL toelaten"
-#: models.py:54
+#: models.py:49
msgid ""
"If enabled, you can fill in form fields by adding them to the query string."
msgstr ""
"Indien geactiveerd, kunt u formuliervelden invullen door deze aan de query-"
"string toe te voegen. "
-#: models.py:55
+#: models.py:50
msgid "message template"
msgstr "Berichtsjabloon"
-#: models.py:55
+#: models.py:50
msgid ""
"Your form fields are available as template context. Example: \"{{ message }}"
"\" if you have a field named `message`. To iterate over all fields, use the "
@@ -216,15 +201,15 @@ msgstr ""
"velden te itereren, gebruikt u de variabele `data`: een lijst met een dict "
"voor elk veld met de elementen `name`, `label` en `value`."
-#: models.py:56
+#: models.py:51
msgid "form template"
msgstr "Formulier-sjabloon"
-#: models.py:57
+#: models.py:52
msgid "display logged submissions with form"
msgstr ""
-#: models.py:61
+#: models.py:56
msgid "Forms"
msgstr "Formulieren"
@@ -233,105 +218,111 @@ msgid "Fields"
msgstr "Velden"
#: models.py:177
-msgid "Form log"
-msgstr "Formulier-log"
-
-#: models.py:178
-msgid "Form logs"
-msgstr "Formulier-logs"
-
-#: models.py:184
msgid "field class"
msgstr "Veldklasse"
-#: models.py:185
+#: models.py:178
msgid "position"
msgstr "Positie"
-#: models.py:188
+#: models.py:181
msgid "label"
msgstr "Label"
-#: models.py:189
+#: models.py:182
msgid "required"
msgstr "Vereist"
-#: models.py:190
+#: models.py:183
msgid "include in result"
msgstr "In resultaat plaatsen"
-#: models.py:191
+#: models.py:184
msgid "widget"
msgstr "Widget"
-#: models.py:192
+#: models.py:185
msgid "initial value"
msgstr "Initiële waarde"
-#: models.py:193
+#: models.py:186
msgid "help text"
msgstr "Hulptekst"
-#: models.py:195
+#: models.py:188
msgid "values"
msgstr "Waardes"
-#: models.py:195
+#: models.py:188
msgid "One value per line"
msgstr "Eén waarde per regel"
-#: models.py:196
+#: models.py:189
msgid "labels"
msgstr "Labels"
-#: models.py:196
+#: models.py:189
msgid "One label per line"
msgstr "Eén label per regel"
-#: models.py:198
+#: models.py:191
msgid "max. length"
msgstr "Max. lengte"
-#: models.py:199
+#: models.py:192
msgid "min. length"
msgstr "Min. lengte"
-#: models.py:200
+#: models.py:193
msgid "max. value"
msgstr "Max. waarde"
-#: models.py:201
+#: models.py:194
msgid "min. value"
msgstr "Min. waarde"
-#: models.py:202
+#: models.py:195
msgid "max. digits"
msgstr "Max. aantal cijfers"
-#: models.py:203
+#: models.py:196
msgid "decimal places"
msgstr "Decimalen"
-#: models.py:205
+#: models.py:198
msgid "regular Expression"
msgstr "Reguliere expressie"
-#: models.py:208
+#: models.py:201
msgid "data model"
msgstr "Datamodel"
-#: models.py:209
+#: models.py:202
msgid "empty label"
msgstr "Leeg label"
-#: models.py:212
+#: models.py:205
msgid "field"
msgstr "Veld"
-#: models.py:213
+#: models.py:206
msgid "fields"
msgstr "Velden"
+#: models.py:297 contrib/exporters/__init__.py:60
+msgid "Created"
+msgstr "Aangemaakt"
+
+#: models.py:363
+#, fuzzy
+msgid "field name"
+msgstr "Veldklasse"
+
+#: models.py:367 models.py:372
+#, fuzzy
+msgid "value"
+msgstr "Waardes"
+
#: settings.py:11
msgid "E-mail address"
msgstr "E-mail-adres"
@@ -384,7 +375,7 @@ msgstr "Model-meerkeuze"
msgid "File"
msgstr "Veld"
-#: settings.py:29 settings.py:37
+#: settings.py:29 settings.py:42
msgid "Default"
msgstr "Standaard"
@@ -404,29 +395,29 @@ msgstr "Verborgen veld"
msgid "Radio button"
msgstr "Keuzerondje"
-#: settings.py:38
+#: settings.py:43
msgid "as paragraphs"
msgstr "als paragraaf"
-#: settings.py:39
+#: settings.py:44
msgid "as table"
msgstr "als tabel"
-#: settings.py:40
+#: settings.py:45
msgid "as table (horizontal)"
msgstr ""
-#: settings.py:41
+#: settings.py:46
msgid "as unordered list"
msgstr "als ongesorteerde lijst"
-#: settings.py:42
+#: settings.py:47
msgid "custom implementation"
msgstr "eigen implementatie"
#: uploads.py:20
msgid "This field is required."
-msgstr "Deze veldklasse vereist een model."
+msgstr "Dit veld is verplicht."
#: uploads.py:25
msgid "This file type is not allowed."
@@ -453,22 +444,40 @@ msgstr ""
msgid "form"
msgstr "Formulier"
-#: templates/admin/form_designer/formlog/change_list.html:9
-msgid "Export CSV"
-msgstr "CSV exporteren"
-
-#: templates/admin/form_designer/formlog/change_list.html:16
-msgid "Export XLS"
-msgstr "XLS exporteren"
+#: contrib/exporters/__init__.py:62
+msgid "ID"
+msgstr "ID"
#: templates/html/formdefinition/forms/includes/submit.html:2
msgid "Submit"
msgstr "Verzenden"
-#: templatetags/friendly.py:18
+#: templatetags/friendly.py:20
msgid "yes"
msgstr "ja"
-#: templatetags/friendly.py:18
+#: templatetags/friendly.py:20
msgid "no"
msgstr "nee"
+
+#, fuzzy
+#~ msgid "Export selected %(verbose_name_plural)s as XLS"
+#~ msgstr "Exporteer geselecteerde %(verbose_name_plural) als Excel XLS"
+
+#~ msgid "CSV export is not enabled."
+#~ msgstr "CSV-exporteren is niet geäctiveerd."
+
+#~ msgid "XLS export is not enabled."
+#~ msgstr "XLS-exporteren is niet geäctiveerd."
+
+#~ msgid "Form log"
+#~ msgstr "Formulier-log"
+
+#~ msgid "Form logs"
+#~ msgstr "Formulier-logs"
+
+#~ msgid "Export CSV"
+#~ msgstr "CSV exporteren"
+
+#~ msgid "Export XLS"
+#~ msgstr "XLS exporteren"
View
18 form_designer/middleware.py
@@ -0,0 +1,18 @@
+import sys
+from form_designer.exceptions import HttpRedirectException
+from django.template.base import TemplateSyntaxError
+from django.http import HttpResponseRedirect
+
+class RedirectMiddleware(object):
+ def process_exception(self, request, exception):
+ #django wraps the original exception in a template exception if it
+ #is raised in a node
+ if isinstance(exception, TemplateSyntaxError):
+ try:
+ exception = sys.exc_info()[1]
+ except IndexError, e:
+ return
+
+ if isinstance(exception, HttpRedirectException):
+ return exception.response
+
View
38 ...migrations/0008_auto__add_formvalue__del_field_formlog_data__add_field_formlog_created.py
@@ -7,6 +7,7 @@
class Migration(SchemaMigration):
def forwards(self, orm):
+ # Structure is migrated here, see 0008b_ for data (and cleanup)
# Adding model 'FormValue'
db.create_table('form_designer_formvalue', (
@@ -19,42 +20,26 @@ def forwards(self, orm):
# Adding field 'FormLog.created_by'
db.add_column('form_designer_formlog', 'created_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True), keep_default=False)
-
+
db.rename_column('form_designer_formlog', 'data', 'tmp_data')
+
+
+ def backwards(self, orm):
+ # Data is back-migrated here, see 0008b_ for structure
from form_designer.models import FormLog
- from picklefield import PickledObjectField
+ from picklefield import PickledObjectField
tmp_data = PickledObjectField(null=True, blank=True)
tmp_data.contribute_to_class(FormLog, 'tmp_data')
for log in FormLog.objects.all():
- log.set_data(log.tmp_data)
+ log.tmp_data = log.get_data()
log.save()
-
- # Deleting field 'FormLog.data'
- db.delete_column('form_designer_formlog', 'data')
- db.delete_column('form_designer_formlog', 'tmp_data')
-
-
- def backwards(self, orm):
- # Deleting model 'FormValue'
+ # Clean up
db.delete_table('form_designer_formvalue')
-
- # Adding field 'FormLog.data'
- db.add_column('form_designer_formlog', 'data', self.gf('picklefield.fields.PickledObjectField')(null=True, blank=True), keep_default=False)
-
- from form_designer.models import FormLog
- from picklefield import PickledObjectField
- tmp_data = PickledObjectField(null=True, blank=True)
- tmp_data.contribute_to_class(FormLog, 'data')
-
- for log in FormLog.objects.all():
- log.data = log.get_data()
- raise Exception(log.data)
- log.save()
-
- # Deleting field 'FormLog.created_by'
db.delete_column('form_designer_formlog', 'created_by_id')
+ db.rename_column('form_designer_formlog', 'tmp_data', 'data')
+
models = {
@@ -150,6 +135,7 @@ def backwards(self, orm):
'Meta': {'object_name': 'FormLog'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'tmp_data': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'}),
'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'logs'", 'to': "orm['form_designer.FormDefinition']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
View
136 form_designer/migrations/0008b_migrate_data_from_0008.py
@@ -0,0 +1,136 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Data is migrated here, see 0008_ for structure
+ from form_designer.models import FormLog
+ from picklefield import PickledObjectField
+ tmp_data = PickledObjectField(null=True, blank=True)
+ tmp_data.contribute_to_class(FormLog, 'tmp_data')
+
+ for log in FormLog.objects.all():
+ log.set_data(log.tmp_data)
+ log.save()
+
+ # Clean up
+ db.delete_column('form_designer_formlog', 'tmp_data')
+
+
+ def backwards(self, orm):
+ # Structure is back-migrated here, see 0008_ for data (and cleanup)
+ # (because we can't use a column we add in this transaction)
+ db.add_column('form_designer_formlog', 'tmp_data', self.gf('picklefield.fields.PickledObjectField')(null=True, blank=True), keep_default=False)
+
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'form_designer.formdefinition': {
+ 'Meta': {'object_name': 'FormDefinition'},
+ 'action': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'allow_get_initial': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'display_logged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'error_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'form_template_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'log_data': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'mail_from': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_subject': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_to': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'message_template': ('form_designer.fields.TemplateTextField', [], {'null': 'True', 'blank': 'True'}),
+ 'method': ('django.db.models.fields.CharField', [], {'default': "'POST'", 'max_length': '10'}),
+ 'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
+ 'private_hash': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40'}),
+ 'public_hash': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40'}),
+ 'require_hash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'save_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'submit_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'success_clear': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'success_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'success_redirect': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
+ },
+ 'form_designer.formdefinitionfield': {
+ 'Meta': {'ordering': "['position']", 'object_name': 'FormDefinitionField'},
+ 'choice_labels': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'choice_model': ('form_designer.fields.ModelNameField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'choice_model_empty_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'choice_values': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'decimal_places': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'field_class': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['form_designer.FormDefinition']"}),
+ 'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'include_result': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'initial': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'max_digits': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'max_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'max_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'min_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'min_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'regex': ('form_designer.fields.RegexpExpressionField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'required': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'widget': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True', 'blank': 'True'})
+ },
+ 'form_designer.formlog': {
+ 'Meta': {'object_name': 'FormLog'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'logs'", 'to': "orm['form_designer.FormDefinition']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ 'form_designer.formvalue': {
+ 'Meta': {'object_name': 'FormValue'},
+ 'field_name': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'form_log': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'values'", 'to': "orm['form_designer.FormLog']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'value': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['form_designer']
View
127 form_designer/migrations/0009_auto__add_field_formdefinition_redirection_url.py
@@ -0,0 +1,127 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding field 'FormDefinition.redirection_url'
+ db.add_column('form_designer_formdefinition', 'redirection_url', self.gf('django.db.models.fields.URLField')(max_length=255, null=True, blank=True), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'FormDefinition.redirection_url'
+ db.delete_column('form_designer_formdefinition', 'redirection_url')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'form_designer.formdefinition': {
+ 'Meta': {'object_name': 'FormDefinition'},
+ 'action': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'allow_get_initial': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'display_logged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'error_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'form_template_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'log_data': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'mail_from': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_subject': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_to': ('form_designer.fields.TemplateCharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'mail_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'message_template': ('form_designer.fields.TemplateTextField', [], {'null': 'True', 'blank': 'True'}),
+ 'method': ('django.db.models.fields.CharField', [], {'default': "'POST'", 'max_length': '10'}),
+ 'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
+ 'private_hash': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40'}),
+ 'public_hash': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40'}),
+ 'redirection_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'require_hash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'save_uploaded_files': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'submit_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'success_clear': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'success_message': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'success_redirect': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
+ },
+ 'form_designer.formdefinitionfield': {
+ 'Meta': {'ordering': "['position']", 'object_name': 'FormDefinitionField'},
+ 'choice_labels': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'choice_model': ('form_designer.fields.ModelNameField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'choice_model_empty_label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'choice_values': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'decimal_places': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'field_class': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['form_designer.FormDefinition']"}),
+ 'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'include_result': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'initial': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'max_digits': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'max_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'max_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'min_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'min_value': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'regex': ('form_designer.fields.RegexpExpressionField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'required': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'widget': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True', 'blank': 'True'})
+ },
+ 'form_designer.formlog': {
+ 'Meta': {'object_name': 'FormLog'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+ 'form_definition': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'logs'", 'to': "orm['form_designer.FormDefinition']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ 'form_designer.formvalue': {
+ 'Meta': {'object_name': 'FormValue'},
+ 'field_name': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'form_log': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'values'", 'to': "orm['form_designer.FormLog']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'value': ('picklefield.fields.PickledObjectField', [], {'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['form_designer']
View
8 form_designer/models.py
@@ -45,6 +45,7 @@ class FormDefinition(models.Model):
log_data = models.BooleanField(_('log form data'), help_text=_('Logs all form submissions to the database.'), default=True)
save_uploaded_files = models.BooleanField(_('save uploaded files'), help_text=_('Saves all uploaded files using server storage.'), default=True)
success_redirect = models.BooleanField(_('HTTP redirect after successful submission'), default=True)
+ redirection_url = models.URLField(_('redirect URL'), help_text=_('Leave blank if you would like to redirect to this page, otherwise it will redirect to a custom url.'), max_length=255, blank=True, null=True)
success_clear = models.BooleanField(_('clear form after successful submission'), default=True)
allow_get_initial = models.BooleanField(_('allow initial values via URL'), help_text=_('If enabled, you can fill in form fields by adding them to the query string.'), default=True)
message_template = TemplateTextField(_('message template'), help_text=_('Your form fields are available as template context. Example: "{{ message }}" if you have a field named `message`. To iterate over all fields, use the variable `data` (a list containing a dictionary for each form field, each containing the elements `name`, `label`, `value`).'), blank=True, null=True)
@@ -162,6 +163,13 @@ def send_mail(self, form, files=[]):
message.send(fail_silently=False)
+ def post_submit(self, form, request):
+ """
+ Hook for form subclasses to define, in order to perform
+ additional actions after a form is successfully submitted.
+ """
+ pass
+
@property
def submit_flag_name(self):
name = settings.SUBMIT_FLAG_NAME % self.name
View
6 form_designer/settings.py
@@ -1,10 +1,8 @@
-import os.path
-
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.files.storage import get_storage_class
-STATIC_URL = os.path.join(getattr(settings, 'STATIC_URL', settings.MEDIA_URL), 'form_designer')
+STATIC_URL = '/'.join((getattr(settings, 'STATIC_URL', settings.MEDIA_URL).rstrip('/'), 'form_designer'))
FIELD_CLASSES = getattr(settings, 'FORM_DESIGNER_FIELD_CLASSES', (
('django.forms.CharField', _('Text')),
@@ -33,7 +31,7 @@
('django.forms.widgets.RadioSelect', _('Radio button')),
))
-EXPORTER_CLASSES = getattr(settings, 'FORM_DESIGNER_WIDGET_CLASSES', (
+EXPORTER_CLASSES = getattr(settings, 'FORM_DESIGNER_EXPORTER_CLASSES', (
'form_designer.contrib.exporters.csv_exporter.CsvExporter',
'form_designer.contrib.exporters.xls_exporter.XlsExporter',
))
View
57 form_designer/static/form_designer/js/jquery-inline-positioning.js
@@ -46,36 +46,39 @@ jQuery(function($) {
});
}
- var addRow = target.find('.add-row');
- addRow.remove();
- var ordered = [];
- var unordered = [];
- // Initially, remove and re-append all inlines ordered by their "position" value
- target.find(item).each(function(i) {
- var initialPos = $(this).find(positionInput).val();
- if (initialPos) {
- while (initialPos < ordered.length && ordered[initialPos]) {
- initialPos++;
+ target.each(function() {
+ var group = $(this);
+ var addRow = group.find('.add-row');
+ addRow.remove();
+ var ordered = [];
+ var unordered = [];
+ // Initially, remove and re-append all inlines ordered by their "position" value
+ group.find(item).each(function(i) {
+ var initialPos = $(this).find(positionInput).val();
+ if (initialPos) {
+ while (initialPos < ordered.length && ordered[initialPos]) {
+ initialPos++;
+ }
+ ordered[initialPos] = this;
+ } else {
+ unordered[unordered.length] = this;
}
- ordered[initialPos] = this;
- } else {
- unordered[unordered.length] = this;
+ this.parentElement.removeChild(this);
+ });
+ for (var i = 0; i < ordered.length; i++) {
+ var el = ordered[i];
+ if (el) {
+ group.append(el);
+ }
}
- this.parentElement.removeChild(this);
+ // Add "position"-less elements in the end
+ for (var i = 0; i < unordered.length; i++) {
+ var el = unordered[i];
+ group.append(el);
+ }
+ group.append(addRow);
});
- for (var i = 0; i < ordered.length; i++) {
- var el = ordered[i];
- if (el) {
- target.append(el);
- }
- }
- // Add "position"-less elements in the end
- for (var i = 0; i < unordered.length; i++) {
- var el = unordered[i];
- target.append(el);
- }
- target.append(addRow);
-
+
target.sortable({
containment: 'parent',
/*zindex: 10, */
View
18 form_designer/templatetags/widget_type.py
@@ -1,6 +1,18 @@
from django import template
register = template.Library()
-@register.filter('field_type')
-def field_type(obj):
- return obj.__class__.__name__
+
+@register.filter
+def field_type(field):
+ """
+ Show actual field type of a BoundField
+ """
+ return field.field.__class__.__name__
+
+
+@register.filter
+def widget_type(field):
+ """
+ Show widget type of the BoundField
+ """
+ return field.field.widget.__class__.__name__
View
13 form_designer/views.py
@@ -6,6 +6,7 @@
from form_designer import settings as app_settings
from django.contrib import messages
from django.core.context_processors import csrf
+from django.conf import settings
import os
import random
@@ -43,13 +44,21 @@ def process_form(request, form_definition, extra_context={}, disable_redirection
form_definition.log(form, request.user)
if form_definition.mail_to:
form_definition.send_mail(form, files)
+ if hasattr(form_definition, 'post_submit'):
+ form_definition.post_submit(form=form, request=request)
+
if form_definition.success_redirect and not disable_redirection:
- return HttpResponseRedirect(form_definition.action or '?')
+ if form_definition.redirection_url:
+ url = form_definition.redirection_url
+ else:
+ url = form_definition.action or '?'
+ #only want to raise a redirect if the middleware is set up to handle it
+ return HttpResponseRedirect(url)
if form_definition.success_clear:
form = DesignedForm(form_definition) # clear form
else:
form_error = True
- messages.error(request, error_message)
+ #messages.error(request, error_message)
else:
if form_definition.allow_get_initial:
form = DesignedForm(form_definition, initial_data=request.GET)
View
27 setup.py
@@ -1,23 +1,24 @@
# encoding=utf8
import os
-from distutils.core import setup
+from setuptools import setup
+
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
README = read('README.rst')
setup(
- name = "django-form-designer",
- version = "0.7.0",
- url = 'http://github.com/philomat/django-form-designer',
- license = 'BSD',
- description = "Design contact forms, search forms etc from the Django admin, without writing any code. Integrates with Django CMS.",
- long_description = README,
+ name="django-form-designer",
+ version="0.7.0",
+ url='http://github.com/MagicSolutions/django-form-designer',
+ license='BSD',
+ description="Design contact forms, search forms etc from the Django admin, without writing any code. Integrates with Django CMS.",
+ long_description=README,
- author = 'Samuel Luescher',
- author_email = 'sam at luescher dot org',
- packages = [
+ author='Samuel Luescher',
+ author_email='sam at luescher dot org',
+ packages=[
'form_designer',
'form_designer.migrations',
'form_designer.templatetags',
@@ -26,7 +27,7 @@ def read(fname):
'form_designer.contrib.cms_plugins',
'form_designer.contrib.cms_plugins.form_designer_form',
],
- package_data = {
+ package_data={
'form_designer': [
'static/form_designer/js/*.js',
'templates/admin/form_designer/formlog/change_list.html',
@@ -37,7 +38,7 @@ def read(fname):
'locale/*/LC_MESSAGES/*',
],
},
- classifiers = [
+ classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Django',
'Intended Audience :: Developers',
@@ -46,7 +47,7 @@ def read(fname):
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
],
- install_requires = [
+ install_requires=[
'django-picklefield',
],
)

0 comments on commit 9d7b810

Please sign in to comment.