Giter Site home page Giter Site logo

mishbahr / djangocms-forms Goto Github PK

View Code? Open in Web Editor NEW
123.0 123.0 96.0 1.89 MB

The easiest and most flexible Django CMS Form builder — Create forms quickly without ever touching code. Every field type you may need is available within a simple drag and drop interface.

Home Page: https://pypi.python.org/pypi/djangocms-forms/

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.96% Python 90.21% CSS 0.35% JavaScript 4.05% HTML 4.43%

djangocms-forms's People

Contributors

alsoicode avatar driesdesmet avatar gatsinski avatar itcrab avatar mishbahr avatar rda-dev avatar selectnull avatar tdsymonds avatar vstoykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangocms-forms's Issues

How to get CKEditor to handle Textarea?

Hi,
I am sorry if this is not the right place to ask but I just couldn't figure out where to drop my question. I guess it must be simple but I couldn't find how to so CKEditor (already installed through djangocms-text-ckeditor) could be used to handled TextArea? Should I make a custom field? How?
Once again, sorry if it is not the right place and thank you for your help.

ValueError: too many values to unpack (expected 2)

When I add this to settings
DJANGOCMS_FORMS_TEMPLATES = ( # ('djangocms_forms/form_template/default.html', _('Default')), ('templates/custom/contact.html','Contact') )

the following error happens

ValueError: too many values to unpack (expected 2)

Feature Request - Create form once, use in several places

Hi,
when adding a form to a placeholder, I'd like to be able to select an existing form from an inventory of all forms that have been created in addition to the possibility to create a new form.

Sample use case: Adding a subscribe to mailing list form in various places, with all data collected in the same form.

Error in "Export Form submissions"

Hi Mishbahr!

Thank you for sharing you djangocms-forms.
I was getting an error when trying to "Export Form submissions" in Home › Forms › Form submissions.
I want to share with you what I did to solve it, in case I can help someone else:

Exception Value: 'WSGIRequest' object has no attribute 'REQUEST'
Exception Location: /home/VirtualEnvs/project/lib/python3.5/site-packages/djangocms_forms/admin.py in export_view, line 242

What I did was replace (in admin.py) the line242---> 'is_popup': '_popup' in request.REQUEST,
by---> 'is_popup': request.GET.get('_popup'),

Thank you and best regargs!

Exporting to excel throws 500 when form name is > 31 chars

Line in question: https://github.com/mishbahr/djangocms-forms/blob/master/djangocms_forms/admin.py#L165

dataset = Dataset(title=latest_submission.plugin.name)

Limitation on excel sheet names cause exporting data that contain names greater then 31 characters. Here is the line that checks for sheet names in xlwt lib https://github.com/kennethreitz/tablib/blob/a785d77901f307ef499621753b078743e2fabb81/tablib/packages/xlwt/Utils.py#L185 and the line that raises the exception https://github.com/kennethreitz/tablib/blob/a785d77901f307ef499621753b078743e2fabb81/tablib/packages/xlwt/Workbook.py#L318-L319

Not sure the best solution, perhaps title[:31] when making the dataset or enforcing the name to have a max length.

Page not found (404) after form submission

After I clicked the submit button in the form on my site, the link was redirected to /forms/submit/ using POST method, however Page not found (404) was Raised by cms.views.details. Should I setup the urlpatterns for /forms/submit/ ?

FormSubmission.created_by field in Form Export

I am wondering why the created_by field is present in the admin form list view, however it doesn't carry forward to the exported file? The referrer, ip and created_date are all exported, is there a reason the created_by user is not?

Load instances of Form for users

Hey,

is it possible to reload the form submission of a user? Just like it would be with an UpdateView. Maybe I missed something in the docs.

404 Using Postgres DB

I was able to successfully create a simple form using sqlite3 db. I switched to a Postgres db, ran python manage.py migrate with no problems and tried the same code and I come up with a 404 error.

Page not found (404)
Request Method: POST
Request URL: http://127.0.0.1:8000/en/forms/submit/
Raised by: cms.views.details
Using the URLconf defined in jsg.urls, Django tried these URL patterns, in this order:
^media/(?P<path>.*)$
^static\/(?P<path>.*)$
^en/ ^admin/
^en/ ^sitemap\.xml$
^en/ ^select2/
^en/ ^ ^cms_wizard/
^en/ ^ ^(?P<slug>[0-9A-Za-z-_.//]+)/$ [name='pages-details-by-slug']
^en/ ^ ^$ [name='pages-root']
^en/ ^ ^forms/submit/$ [name='djangocms_forms_submissions']
The current URL, /en/forms/submit/, didn't match any of these.

I went back to the original default template and it is still the same problem.

form not rendered

Hi,

I have django cms 3.1.2 with django 1.8.3 installed.
I followed your installation instructions all work fine and I haven't any errors.

I can assign form app to a page, hook form on placeholder, edit the form and save it but the form is not rendered. When I inspect the DOM with chrome I only view the DIV container for the plugin and nothing inside this.

Any idea ?

thanks

Pre-validations

Hi,

Is there any way to add validations before the plugin's validations take place? I have a couple of fields that I initialize as not required, but if the user selects certain option, I have to make that field(s) required. Is there any way to achieve this with the current implementation of the plugin? If not, is there any way that I can prevent the plugin submit and do some validations of my own before triggering the plugin's submit?

Empty choice of Form Template yields in error during rendering

Per default, Form Template is an empty choice. This used to work, but since I updated to python 3.4, Django 1.11.11 and django-cms 3.5.1 on Ubuntu 14.04, this produces an error during template rendering. On FormPlugin.get_render_template, the instance.form_template is an empty string, which produces the error, as select_template only excepts a TemplateDoesNotExist error and not the necessary IsADirectoryError.

Change The template of Filed

I want to change from this

{% if not field|is_checkbox %}
    {{ field}}
{% endif %}

to this

{% if not field|is_checkbox %}
    <input type="text" class="form-control" id="{{ field.auto_id }}" name="{{ field.name }}" placeholder="Name" required>
{% endif %}

but I can't know the property of the field, the only ting I know is .name and .auto_id

by the way, it is customization of https://github.com/mishbahr/djangocms-forms/blob/master/djangocms_forms/templates/djangocms_forms/form_template/default.html

Mimetype 'application/javascript'

The embedded script inside the default.html template causes error when using compressor, since there is no precompiler for application/javascript. Can you change it to text/javascript? or remove it altogether...

Slow e-mail

The contact-form is slow to react when sending e-mails. Seems like it is synchronous. Is there an available setting to make it asynchronous?

Incorrect behavior with "Form submissions" while copying the plugin.

If the plugin is copied the original reference to the Form instance is preserved and it's name is replaced with the name of the new "form". This way there are more than one FormDefinitions which point to the same Form. In the administration in "Form submissions" submissions from all of these forms are combined under one "Form" which has the name of the last FormDefinition saved. This is kind of confusing.

The problem probably lies in the logic of PluginReferenceField.pre_save. Further investigation is needed.

basestring not defined in Python3

The 'friendly' template filter has

@register.filter
def friendly(value):
    if value in (None, '', [], (), {}):
        return None

    if type(value) is list:
        value = ', '.join(value)
    if type(value) is bool:
        value = yesno(value, u'{0},{1}'.format(_('Yes'), _('No')))
    if not isinstance(value, basestring):
        value = unicode(value)
    return value

but basestring is not defined when using python3. The default e-mail template is using this filter, so that's how I caught it. I'm not sure what the 'correct' solution is, because the whole python3 unicode thing scares me. Just thought I'd file this here.

python34 Install on windows error!

Traceback :
File "setup.py", line 23, in
readme = open('README.rst').read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 4932: illegal multibyte sequence

and I found the problem in README.rst file on line 140 ~ line 144, the "—" symbol,change it to "-" and then will run success!

Missing server invalidation

Once a form has been posted, the server does not invalidate it, nor does it provide a method to do so.
This might results in a spamming problem since many spambots simply records the end URL for the POSTed data and use that for posting spam.
In it's easiest form, the server invalidation should have checked that that honeypot field exists and is empty. Otherwise, if honeypot was introduced after the spambot got the URL, it does not protect from spam.

Also, there are many more protections against spamming that could have helped (check out http://nedbatchelder.com/text/stopbots.html)

Custom name attributes

Currently, the name attribute of a field is defined from the field name. This means that if I have the same form in different languages, there's no way of mapping the fields between languages. Is there a way to define a custom name attribute value for each field?

KeyError on 'current_page' in the form cleaned_data

Where does current_page get set in the form?

I've had error reports come in that upon submission our dev site is returning a 500 error, and I'm seeing a KeyError on current_page from;

else:
    messages.success(self.request,
        strip_tags(form.form_definition.post_submit_msg))
    return redirect(
        form.redirect_url or form.cleaned_data['current_page'])

I can only see attempts to get current_page from cleaned_data, but no other mention of it;
https://github.com/mishbahr/djangocms-forms/search?utf8=%E2%9C%93&q=current_page

I've debugged this & I can see what I expected - my form fields, plus form_id and referrer. Oddly this was working locally yesterday.

Should this not be doing form.cleaned_data['referrer'] instead in order to return to the page you've posted from?

I'm running my forked codebase & it seems to work with this fix; master...marksweb:referrer_fix

admin html rendering

if we submit form with html in textfield, it will be rendered in admin page a workaround is to add
try: value = strip_tags(self.cleaned_data[field]) except: value = self.cleaned_data[field]
in save method in forms.py @ line 338

Installing djangocms-forms in Aldryn environment makes adding plugins fail

I setup a new site in Aldryn, just by using their dashboard to collect addons I want.
Thereby I uninstall their default Aldryn-Forms and install Django-cms-forms.

Then I deploy the test site and try to add any plugin, i.e. "text" or "form".

The page fails to add the plugin, and comes back with an error.

Sometimes it seems it did add the plugin, only showing after I surf away, and back to the page again.

Unfortunately I don't have any logs, since they only flash by at the Aldryn environment.

number field causes internal server error

Adding a number field to a form in django-cms==3.4.1 with djangocms-forms==0.2.1 using the Default form template causes "POST /forms/submit/ HTTP/1.1" 500 18223 with We're sorry. Something Unexpected Happened. Please Try Again Later..

Whereas the same form before the number field had been added - a sole text field - successfully sent the form via email. Remove the number field and the form succeeds again.

Change the number field to a checkbox or a phone number field and it all works fine too.

What can I do to determine what's going on?

Problem with exported xls files

Few days ago I was informed about problems with the exported files of our forms, made with djangocms-forms. When you open the exported .xls file with Microsoft Office Excel the following error message appears:

"We found a problem with some content in 'filename'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."

After clicking "Yes" the file opens but there are a lot of empty cells and others are filled with random unicode characters. The fields are required but just to ensure myself I exported the same data in csv and all cells were correctly filled. Same is the story with Libre Office.

I managed to reproduce the problem by submitting some not so common unicode characters. At first I had no idea where it comes from because there wasn't anything wrong with the code responsible for the export but after further investigation I located the error. I was suprised to find it not inside djangocms-forms but in tablib, which is used for exporting. The problem is here:

https://github.com/kennethreitz/tablib/blob/master/tablib/formats/_xls.py#L136

I'm not opening an issue in tablib project because actually the problem is already reported there. There is an issue opened since September 2nd 2014 and it is still not solved. Maybe you can use another library for exporting .xls files or you can find a workaround. I tried using different version of tablib but without any success.

https://github.com/kennethreitz/tablib/issues/168

I couldn't find any specific character that causes the problem and it seems that it behaves differently when different set of data is already submitted. Despite that I always managed to reproduce it by just copying the content of this page, containing large set of all Unicode group of characters.

http://www.ltg.ed.ac.uk/~richard/unicode-sample.html

Create a simple form with at least one text field and submit it several times to have initial data to broke. Then paste the copied string.

There isn't anything special in my setup.

tablib==0.11.4
django-cms==3.3.3
djangocms-forms==0.2.4

Can't use filefield with S3 storage backend

Using this setting:

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

I'm getting

NotImplementedError at /forms/submit/
This backend doesn't support absolute paths.

I wonder if it's really necessary to return the filepath in the handle_uploaded_files() function, since a StoredUploadedFile field is save in form.cleaned_data for later sending and saving.

Making successful submission a conversion point

Hi!

I am trying to make my form be a conversion point on my website. Meaning, I would like to send some data to Google Analytics after the form was successfully submitted. I have two questions about this:

1.) The sending to GA should be done, when formValid is called. What do you think would be the best way of going about this? Should I be extending the CMSForms in jquery.djangocms-forms.js, or is there a neater way of doing it?

2.) It'd be much easier if this was already a part of the project. I can create a PR for this feature, but am not sure if you would want to include it (I assume it would depend on whether or not this is a common requirement). Let me know if there is a need for this or not.

Thanks,
Žan

Field names with spaces causes export to miss data

Having a field name with spaces results in the following option in the export admin page

<select id="id_headers_to" multiple="multiple" size="0" name="headers" class="filtered" style="height: 262px;">
 <option value="Favorite">Favorite JS Framework</option>
</select>

Then exporting the data for this field is always None

Apphook support for CMS 3.4

Django CMS 3.4 requires cms_app.py to be called cms_apps.py. Form can't be selected from the Application dropdown due to it (throwing a 404 on submit)

Issues with files stored using boto

I'm using S3 for file storage through the boto3 storage class. When generating links to files signatures are created to authorise access to files and these include an expiry.

At the moment when files are submitted through a form the value stored for the file includes all the additional params required. This includes the signature and expiry so the default expiry time of 1 hour, for example, means a submission can only be viewed for an hour.

Really the path to the file should be stored, then when the submission is viewed in admin, the URL should be pulled from the storage class so that it can set a signature at that point, allowing for 1 hours viewing from the point the submission is opened in admin.

Error 500 when referrer is missing from cleaned data and request is not AJAX

When normal POST request was made (not an AJAX one) then the view is trying redirect the user back to the form URL pointed in referrer field. If for some reason this field is missing, then ERROR 500 is raised with KeyError about referrer missing from cleaned_data.

Some things that need to be done is to make this logic more "exception safe". Also from security standpoint there are things that probably should be done about restricting the values that can be posted for this value.

I will look at it to prepare a fix.

invalid "This field is required" error after submit

I have a form with two fields - email (type Email) and message body (type Text Area).
Both fields are required, but after I fill them and Submit the form (form is indeed submitted), I get the above error from /forms/submit ({"errors": {"all": ["This field is required."]}, "formIsValid": false})

Static Files Namespacing

I consider this a low priority issue, but also one that can be easily fixed.

The standard practice for namespacing static files in django is to begin paths with a unique identifier, usually the package name. djangocms-forms instead uses "css/djangocms_forms" and "/djangocms_forms", which effectively creates two generic namespaces. This should be changed to reverse those path segments to "djangocms_forms/css" and "djangocms_forms/js".

Dynamic DropDown

Hi, nice and easy, but I would like to use a dynamic dropdown list from one of my models (MySQL table)

I haven't been able to find any documentation on it for DjangoCMS so I figured I'd ask.

Is this possible?

Missing migrations

When installing into Django 1.11 on Python3.6 there are a number of AlterField migrations missing.

If I run makemigrations I get:

Migrations for 'djangocms_forms':
  ~/lib/python3.6/site-packages/djangocms_forms/migrations/0006_auto_20180104_0929.py
    - Alter field cmsplugin_ptr on formdefinition
    - Alter field form_template on formdefinition
    - Alter field field_type on formfield
    - Alter field ip on formsubmission

Ideally these migrations could be added and deployed to PyPI. If you like I can submit a pull request with them but it might be easier for you to do it yourself if you've got a dev environment set up already.

Giving 404 while submitting the form

I creted a form using the documentation, but I didn't do any configuration steps. When I submit my form, its giving me 404.

"POST /en/forms/submit/ HTTP/1.1" 404 3307"

Typo in README

Underline symbol. Django CMS 3.4.1

DJANGOCMS_FORMS_TEMPLATES = (
    ('djangocms_forms/form_template/default.html', _('Default')),
)

should be:

DJANGOCMS_FORMS_TEMPLATES = (
    ('djangocms_forms/form_template/default.html', ('Default')),
)

UnicodeEncodeError at /ru/

Hello, Mishbahr!
I'm getting error when using cyrillic letters for options in dropdown list or radio buttons.

UnicodeEncodeError at /ru/ 'ascii' codec can't encode characters in position 2-8: ordinal not in range(128)

Could you add support of the unicode for dropdowns and other controls in your form app?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.