stephenmcd / django-forms-builder Goto Github PK
View Code? Open in Web Editor NEWLet users build forms in Django admin
License: BSD 2-Clause "Simplified" License
Let users build forms in Django admin
License: BSD 2-Clause "Simplified" License
"Export entries" and "View on site" should be in a column called "Actions", right now it's using up too much vertical space.
The norwegian-translation branch forks at the initial commit and introduces many redundant commits, cluttering the git history.
$ git log --oneline --graph --all --date-order
...
| * b70e2d0 Cleaned up imports as per PEP 8
* | 19f1630 Cleaned up imports as per PEP 8
| * b5bfb09 Made the default for the status field on BuiltForm use the STATUS_PUBLIC constant rather than the actual value of it.
* | 57ac848 Made the default for the status field on BuiltForm use the STATUS_PUBLIC constant rather than the actual value of it.
| * 687c3d1 --HG-- extra : convert_revision : svn%3A75ee960e-7cdb-11de-a253-d3d9d9688d98/trunk%402
* | 039e539 --HG-- extra : convert_revision : svn%3A75ee960e-7cdb-11de-a253-d3d9d9688d98/trunk%402
|/
* 26bbd72 Initial directory structure.
I recommend a rebase
git checkout norwegian-translation; git rebase 70115d9; git push -f
Or removing the norwegian-translation branch if you don't need to do development on it anymore.
git push origin :norwegian-translation
Adding two fields with the same name raises an IntegrityError - which will result into a empty page for production server - this should be properly catched.
The current browser implementation of date and datetime is currently buggy at best or non existant.
Give us an option to use the Django widgets instead.
FORMS_BUILDER_USE_BUILTIN_WIDGETS
On a clean install of Django, both 1.3 and 1.4, I ran into a KeyError for 'request'. The stack trace led me to the following:
forms_builder/forms/templatetags/forms_builder_tags.py in render line 20:
request = context["request"]
Request wasn't being included into the context but after a little bit of searching I found that I added 'django.core.context_processors.request'
to settings.TEMPLATE_CONTEXT_PROCESSORS
request
was available in all templates. By default, `'django.core.context_processors.request' is not included.
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORS
So now my TEMPLATE_CONTEXT_PROCESSORS
is as follows:
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
'django.core.context_processors.request', # added for django-formsbuilder
)
Perhaps this small change to settings.py should be added to the README. I'd be happy to do this in a Pull request if you would like.
Thanks
I noticed that fields are not ordered in specified order.
Why is order_with_respect_to
meta attribute used? Could it not be just
ordering = ('form', 'order', )
It would be useful to be able to:
I will probably add this for my project, but think it would be of general usefulness. This can also be expanded to allow a choice of "themes" from the Admin panel.
The "Home" link in the breadcrumb navigation points to http://localhost:8000/ and not http://localhost:8000/admin/, like it should.
Hi there,
after installation I tried to add a new form and hit the following error on a Win7 x64/Py 2.7/Django 1.4 system:
TemplateSyntaxError at /admin/forms/form/add/
Could not parse the remainder: ':form_entries' from 'admin:form_entries'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/forms/form/add/
Django Version: 1.4
Exception Type: TemplateSyntaxError
Exception Value:
Could not parse the remainder: ':form_entries' from 'admin:form_entries'
Exception Location: D:\Python\django\lib\site-packages\django-1.4-py2.7.egg\django\template\base.py in __init__, line 563
Python Executable: D:\Python\django\Scripts\python.exe
Python Version: 2.7.2
Python Path:
['D:\\Workspace\\egu\\src',
'D:\\Python\\django\\lib\\site-packages\\django-1.4-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\pyscss-1.1.3-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_pagination-1.0.7-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_simple_captcha-0.3.4-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\pip-1.1-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\ipython-0.12.1-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\distribute-0.6.26-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_constance-0.3-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\vobject-0.8.1c-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\six-1.1.0-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_cal-0.1dev-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\python_dateutil-1.5-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_forms_builder-0.7.3-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_email_extras-0.1.8-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\sphinx_me-0.1.2-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\python_gnupg-0.3.0-py2.7.egg',
'D:\\Workspace\\egu\\src',
'D:\\Python\\django\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\pip-1.0.2-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django_watson-1.1.0-py2.7.egg',
'D:\\Python\\django\\lib\\site-packages\\django-1.3-py2.7.egg',
'D:\\Python\\django\\DLLs',
'D:\\Python\\django\\lib',
'D:\\Python\\django\\lib\\plat-win',
'D:\\Python\\django\\lib\\lib-tk',
'D:\\Python\\django\\Scripts',
'C:\\Program Files\\Python27\\Lib',
'C:\\Program Files\\Python27\\DLLs',
'C:\\Program Files\\Python27\\Lib\\lib-tk',
'D:\\Python\\django',
'D:\\Python\\django\\lib\\site-packages',
'C:\\Program Files\\Python27\\lib\\site-packages\\distribute-0.6.19-py2.7.egg',
'C:\\Program Files\\Python27\\lib\\site-packages\\ipython-0.11-py2.7.egg',
'C:\\Program Files\\Python27\\lib\\site-packages\\ipdb-0.5-py2.7.egg',
'C:\\Program Files\\Python27\\lib\\site-packages\\pyreadline-1.7-py2.7-win-amd64.egg',
'C:\\Program Files\\Python27\\lib\\site-packages\\virtualenv-1.7-py2.7.egg',
'C:\\Program Files\\Python27',
'C:\\Program Files\\Python27\\lib\\site-packages',
'C:\\Program Files\\Python27\\lib\\site-packages\\win32',
'C:\\Program Files\\Python27\\lib\\site-packages\\win32\\lib',
'C:\\Program Files\\Python27\\lib\\site-packages\\Pythonwin',
'C:\\Program Files\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info',
'C:\\Windows\\system32\\python27.zip',
'D:\\Python\\django\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info',
'C:\\Program Files\\Python27\\lib\\site-packages\\PIL',
'C:\\Program Files\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg-info']
Server time: Tue, 22 May 2012 08:51:37 +0200
Error during template rendering
In template D:\Python\django\lib\site-packages\django_forms_builder-0.7.3-py2.7.egg\forms_builder\forms\templates\admin\forms\change_form.html, error at line 9
Could not parse the remainder: ':form_entries' from 'admin:form_entries'
Any idea?
Cheers,
Robert
Current functionality is great, but a good feature would be the ability to render these forms in places like sidebars, or modals, or any page really.
Can you add the formset IntegerField as a field?
Would be useful when you want to make sure the user can only submit a number.
I'm using South to migrate the database. But encountered the following error:
SouthFieldClass(default=[<Site: localhost:8000>], to=orm['sites.Site'], symmetrical=False)
^
SyntaxError: invalid syntax
I think the cause is the following definition:
def default_sites():
return [Site.objects.get_current()]
sites_field = models.ManyToManyField(Site, default=default_sites)
It somehow generates
{'default': '[<Site: local host:8000>]', 'to': "orm['sites.Site']", 'symmetrical': 'False'}
in migration file.
It seems that there isn't support for exporting unicode strings to CSV.
I tried exporting a form with unicode fields (example: Jørn), and got an error.
Traceback:
Environment:
Request Method: POST
Request URL: http://kolwb0060.mil.no:8000/admin/forms/form/export/3/
Django Version: 1.3
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'activitycalendar',
'reversion',
'forms_builder.forms',
'intranet_comments']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Python26\lib\site-packages\django\utils\decorators.py" in _wrapped_view
93. response = view_func(request, *args, **kwargs)
File "C:\Python26\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
79. response = view_func(request, *args, **kwargs)
File "C:\Python26\lib\site-packages\django\contrib\admin\sites.py" in inner
197. return view(request, *args, **kwargs)
File "c:\inetpub\intranett\forms_builder\forms\admin.py" in export_view
95. csv.writerow(rows)
Exception Type: UnicodeEncodeError at /admin/forms/form/export/3/
Exception Value: 'ascii' codec can't encode character u'\xf8' in position 1: ordinal not in range(128)
Since you've added database migration to django-forms-builder, I suggest that it's better to add a section of how to migrate to the latest version if users installed earlier version before in README.
In Project Configuration section, you write:
sync your database
$ python manage.py syncdb
It's better to change it to more details based on following scenarios:
If you've never installed django-forms-builder and don't have South, sync your database
$ python manage.py syncdb
If you've never installed django-forms-builder and have South installed, run the following command:
$ python manage.py migrate forms_builder.forms
If you installed django-forms-builder before and is going to update to the latest version, run the following commands:
$ python manage.py migrate forms_builder.forms 0001 --fake
$ python manage.py migrate forms_builder.forms
Can you add 2 fields to your Form model:
and use these in the e-mails sent to the persons who entered the form. Text can be placed above the current field output.
This won't be needed for the 'copies to' functionality, I think.
There are cases when I want to edit an existing form entry. But looks like FormForForm(form, instance = entry) isn't able to populate the form entry with its field entry values. When I use FormForForm, it's always like a new entry.
I think the problem is in its init function, it always set the initial to be a field's default value. I think init function should be smarter. It should fetch every field entry of the form entry and populate the FormForForm's initial field if instance parameter is set.
Hello! I was playing around with forms-builder. Now, I'm trying to integrate Twitter Bootstrap, so that the form elements are styled using Bootstrap. Now for instance, there are multiple CSS classes provided by Bootstrap; creating a button tag, and giving it a particular class attribute then styles the button accordingly. Is there any way one could do that with forms-builder? Specify HTML tag attributes through the admin interface, something of that sort?
Thanks!
On entering something non-ascii as field label, you get an UnicodeEncodeError on sending the form via email.
Add the URLField field type.
Also use the HTML5 url input type.
It goes to: http://localhost:8000/admin/r/22/1/
When it should go to: http://localhost:8000/forms/test-form/
There should be a way to delete and modify for form entries in the Django admin.
Hi,
would be nice to change the slug after generating of the form by adding
class FormAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug':('title',),}
to admin.py - see http://stackoverflow.com/questions/141487/is-there-an-easy-way-to-populate-slugfield-from-charfield.
Cheers,
Robert
When field is removed from the form, that already have some entries, View Entries admin view will be broken.
Caught KeyError while rendering: 'field_2_filter'
Something like:
View entries: http://localhost:8000/admin/forms/form/export/1/view/
Export CSV: http://localhost:8000/admin/forms/form/export/1/csv/
This would make it quick to check out the entries and get the CSV, by for example having the urls bookmarked.
When I tried look at form, I had saw this
Environment:
Request Method: GET
Request URL: http://localhost:8000/formbuilder/test/
Django Version: 1.3
Python Version: 2.6.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.markup',
'django.contrib.messages',
'rosetta',
'sorl.thumbnail',
'staging',
'utils',
'registration',
'captcha',
'tagging',
'filebrowser',
'chunks',
'haystack',
'forms_builder.forms',
'comments',
'contests',
'content',
'menu',
'news',
'faq',
'blog',
'imagegallery',
'imageconf',
'events',
'videogallery',
'profiles',
'downloads',
'products',
'south',
'bannertop',
'myevents',
'headline']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'content.middleware.FlatpageFallbackMiddleware',
'middleware.MobileDetectionMiddleware')
Traceback:
File "/home/sr/pydev/scms-proj/scms/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/home/sr/pydev/scms-proj/scms/../lib/forms_builder/forms/views.py" in form_detail
28. form_for_form = FormForForm(*args)
File "/home/sr/pydev/scms-proj/scms/../lib/forms_builder/forms/forms.py" in __init__
99. if (settings.FORMS_USE_HTML5 and
Exception Type: AttributeError at /formbuilder/test/
Exception Value: 'module' object has no attribute 'FORMS_USE_HTML5'
#project/settings.py
FORMS_BUILDER_USE_HTML5 = False
In your forms_builder/forms/settings.py FORMS_USE_HTML5
is absent, there is only USE_HTML5
I've created the Dutch translation for your app:
Would you mind placing this in locale/nl/LC_MESSAGES/django.po (and run compilemessages, of course)?
Can't choose:
MultipleChoiceField/django.forms.CheckboxSelectMultiple
Because it's 55 chars, while max_length of field model is 50.
When creating a form, make the field "Intro" optional.
Hi,
Where I can find some example with views.py and more front-end usage?
How can I choose the action of the created form?
Thx!
README says to use the tag {% render_build_form %} but the tag is actually {% render_built_form %}.
There is no way to hook into a form once it has been submitted. If you hook to FormEntry. post_save it will get fired before the fields are saved.
One way that this could be rectified would be by firing a new signal on FormForForm.save() just before it returns.
If I don't specify e-mail addresses to copy the form entry to, then file upload works without problem. But if you do, then the form entry and file are saved, but sending the e-mail copies will throw the following:
File "/home/www/test.artis.nl/django/django-forms-builder/forms_builder/forms/views.py", line 45, in form_detail
f.seek(0)
ValueError: I/O operation on closed file
Can you validate this error?
The files are already closed at the time the the emailing happens.
Traceback:
File "/home/serveruser/.virtualenvs/sifco/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
response = callback(request, *callback_args, **callback_kwargs) File "/home/serveruser/.virtualenvs/sifco/lib/python2.6/site-packages/forms_builder/forms/views.py" in form_detail
f.seek(0)
Exception Type: ValueError at /forms/sifco-forge-rfq/
Exception Value: I/O operation on closed file
Have a column where you show how many entries a form has.
When "File upload" field is added to the form and marked as not required submitting form without file would raise an exception:
Caught Warning while rendering: Column 'value' cannot be null
This is because FileField cleans empty upload to None value which current model schema does not allow. This is tested with mysql.
Solution for this is to allow null fields in value
field of FieldEntry
.
value = models.CharField(max_length=settings.FIELD_MAX_LENGTH, null=True)
I use it in an environment where everyone using it is logged in to Django. On some forms we like to save username. Right now the user have to manually the username.
Can we have an option to save the username, like it already does with the date.
i am newbie
please help
how to add 'forms_builder.forms.urls to your url conf' in practice
just add this line to urls.py?
and where from should appear (url of the page) after i add it?
many thanks
Ubuntu 12.04.3, apache2, mysql, python 2.7.3, mod_wsgi. Uploading files in Korean language products UnicodeEncodeError, but files in English are all okay. What could be look into ?
UnicodeEncodeError at /forms/go/
'ascii' codec can't encode characters in position 72-75: ordinal not in range(128)
Request Method: POST
Request URL: http://testing.domain.com/forms/go/
Django Version: 1.6.1
Exception Type: UnicodeEncodeError
Exception Value:
'ascii' codec can't encode characters in position 72-75: ordinal not in range(128)
Exception Location: /usr/lib/python2.7/genericpath.py in exists, line 18
Python Executable: /usr/bin/python
Python Version: 2.7.3
Unicode error hint
The string that could not be encoded/decoded was: 56ae/최종수정(펼침).
A support for regex pattern in Fields would be nice, since HTML5 also provides regex pattern (http://www.w3schools.com/tags/att_input_pattern.asp)
Hello Stephen,
Nice product!
I have a feature request, which would in my opinion make it even more usable.
I want to be able to add formsets. If would be good, if those formsets would be a tiny bit configurable (I want to be able to assign a CSS class to them, provide max number of formsets, initial number of formsets, etc.)
Best regards,
Artur
Semicolon is used as a CSV delimiter instead of comma in European countries.
Hello Stephen,
I had help of a good django experter and installed the forms builder and upon testing, I found below.
Environment : Ubuntu10.10, default apache, mysql with Firefox and Outlook 2003 version as desktop client
After I submit forms from the browser, I see below. First column is Korean (label) and value looks like below. Any clue as to how I can fix this to support Korean ? The field types with issues are "multiselect, checkboxes". In addition, for file name uploding Korean filename encounters error "'ascii' codec can't encode characters in position 88-91: ordinal not in range(128)" Any clue as to what to check for ?
관심사: [u'\uc0db']
산업분류: [u'\uc0b0\uc5c5\ud558\ub098', u'\uc0b0\uc5c5\uc14b']
Thanks for the great program.
SunJoo
I like idea that base models are implemented as abstract models allowing subclassing.
However, overriding is not so easy, because:
I like IoC ideas discussed in this (question)[http://stackoverflow.com/q/9175244/238628], especially with defining concrete models in settings.py.
What do you think?
There is still and issue with opening the csv file in Excel gives gibberish for norwegian chars. Same with both Excel 2003 win and 2011 mac.
This æøå
becomes æøå
This seems to be a common problem, and a solution seems to be to encode the chars as utf-16.
I've also managed to get it to work by opening the CSV file in Notepad++ and converting it to "utf-8 with BOM". So it might be that it's missing the BOM.
Ability to view form entries in the admin, instead of having to export it to CSV.
In "View entries" html table, the title of an uploaded file should be it's original name and not the file path.
I monkeypatched this in for my client: a 'hint' field in the Field model, that adds the value for 'hint' to the title attribute of the HTML widget.
In my case, I convert this title attribute to an inner label/example/hint inside my input[type=text] and textarea with JavaScript.
Don't know if it's something you could use in general. Could you add 'hint' option and output to title attr of field widget?
In the Forms list the breadcrumb is:
Home > Forms > Forms
But in Export Entries the breadcrumb is:
Home > Export Entries
While it should be:
Home > Forms > Formname > Export Entries
Sometimes I forget which form I'm on, since I have a couple of tabs with the export view open to view new entries, so it would be useful so have the name of the form in the breadcrumb bar.
Enhacement proposal: add slug to Field and use it for field names in FormForForm
instead of id
.
This would allow referencing fields by slug in e-mail response or other processing.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.