Git Product home page Git Product logo

aldryn-forms's Introduction

Deprecated

This project is no longer supported.

Divio will undertake no further development or maintenance of this project. If you are interested in continuing to develop it, use the fork functionality from GitHub. We are not able to transfer ownership of the repository to another party.

Aldryn Forms App

Aldryn Forms allows you to build flexible HTML forms for your Aldryn and django CMS projects, and to integrate them directly in your pages.

Forms can be assembled using the form builder, with the familiar simple drag-and-drop interface of the django CMS plugin system.

Submitted data is stored in the Django database, and can be explored and exported using the admin, while forms can be configured to send a confirmation message to users.

Contributing

This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We're grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Installation

Aldryn Platform Users

Choose a site you want to install the add-on to from the dashboard. Then go to Apps -> Install app and click Install next to Forms app.

Redeploy the site.

Upgrading from < 2.0

Version 2.0 introduced a new model for form data storage called FormSubmission. The old FormData model has been deprecated. Although the FormData model's data is still accessible through the admin, all new form data will be stored in the new FormSubmission model.

Manuall Installation

Run pip install aldryn-forms.

Update INSTALLED_APPS with

INSTALLED_APPS = [
    ...
    'absolute',
    'aldryn_forms',
    'aldryn_forms.contrib.email_notifications',
    'emailit',
    'filer',
    ...
]

Configure aldryn-boilerplates (https://pypi.python.org/pypi/aldryn-boilerplates/).

To use the old templates, set ALDRYN_BOILERPLATE_NAME='legacy'. To use https://github.com/aldryn/aldryn-boilerplate-standard (recommended, will be renamed to aldryn-boilerplate-bootstrap3) set ALDRYN_BOILERPLATE_NAME='bootstrap3'.

Also ensure you define an e-mail backend for your app.

Creating a Form

You can create forms in the admin interface now. Search for the label Aldryn_Forms.

Create a CMS page and install the Forms app there (choose Forms from the Advanced Settings -> Application dropdown).

Now redeploy/restart the site again.

The above CMS site has become a forms POST landing page - a place where submission errors get displayed if there are any.

Available Plug-ins

Form plugin lets you embed certain forms on a CMS page.

Fieldset groups fields.

Text Field renders text input.

Text Area Field renders text input.

Yes/No Field renders checkbox.

Select Field renders single select input.

Multiple Select Field renders multiple checkboxes.

File field renders a file upload input.

Image field same as file field but validates that the uploaded file is an image.

aldryn-forms's People

Contributors

chaosk avatar chive avatar crash843 avatar czpython avatar darioalbanesi avatar digi604 avatar evildmp avatar filwaitman avatar finalangel avatar garetjax avatar itcrab avatar iwangjiaxiang avatar jmelett avatar lionardo avatar lory87 avatar manojiitkgp09 avatar mikek avatar mkoistinen avatar olenamatsak avatar paoloromolini avatar peterw-lwl avatar stefanfoulis avatar trawick avatar treavis avatar vthaian avatar vxsx avatar yakky avatar yvladislav 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

Watchers

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

aldryn-forms's Issues

Error submitting form - but no error in log

I have a form on our client site that displays the "Error message" every time the form submits. But nothing gets logged in our error log. None of the individual fields have error messages - just the form overall.

I have all the necessary requirements in INSTALLED_APPS.

The email backend is set to 'django.core.mail.backends.console.EmailBackend'.

Why is it erroring out? We are running The latest version of aldryn-forms (2.2.1) and Django 1.9.

requirement django-recaptcha throws various errors

NoMigrations: Application '<module 'captcha' from '/Users/finalangel/Sites/divio-standardsite/env/lib/python2.7/site-packages/captcha/__init__.pyc'>' has no migrations.
NoReverseMatch at /en/
Reverse for 'cms_usersettings_change' with arguments '()' and keyword arguments '{}' not found.
IntegrityError: duplicate key value violates unique constraint "django_content_type_pkey"
DETAIL:  Key (id)=(19) already exists.
make: *** [update] Error 1

collapse class makes impossible to configure email notifications

This is how the edit modal looks when I am creating a Form with email notifications with the collapse, as you can see the configuration inputs are missing.

with_collapse

This is how it looks with the collapse class commented out on aldryn_forms/contrib/email_notifications/cms_plugins.py

without_collapse

the version that I'm using is 2.1.1

Notorious form data issue

Currently, the way form data is stored is by combining all fields and values into a single string.
Each field/value combo is joined by a : character and separated from the others via a newline.
This was an early not well thought out design decision because it means that any field that has a value with a : in it will cause Aldryn Forms to think that this value is it's own field.
This affects the importing and storing of form data as pointed out here https://github.com/aldryn/aldryn-forms/blob/master/aldryn_forms/models.py#L395.

I propose that instead of storing all field/values together, we either use a json field (with ordering) or an array field with the field/value pairs. This should be fairly simple to implement but my concern is backwards compatibility, this has to be backwards compatible which means we need a data migration that uses existing logic to separate each field/value pair from the stored string and then store them in the new json or array field, sadly there's no 100% reliable way we can actually tell if a field in the string is valid because of the issue mentioned above, to make it more reliable we could verify each found field with the form plugin fields but this would still not be 100% reliable because the idea behind form data was that the form plugin can be deleted without affecting anything in the stored data.

Thoughts?

Can not run migrations in Django 1.7.8

When i try to run the migrations, the following error occurs:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/aldryn_forms/models.py", line 22, in <module>
    User = get_user_model()
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 137, in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL)
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
    self.check_models_ready()
  File "/Users/marc/.virtualenvironments/bug/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

It seems that there is a problem with the user model loading during import time in models.py .

I mitigated the problem by removing the call to get_user_model() and replacing it with settings.AUTH_USER_MODEL

Since I wasn´t sure how to fix this correctly for other versions, I didn´t open a pull request. Let me now if you need more info to fix the issue properly.

on aldryn the captcha field causes an error

this is because django-simple-captcha requires the captcha urls to be included.

Simple workaround: add the captcha urls to the apphook.

Clean fix: needs the aldryn platform to support custom url inclusions (without apphooks).

select fields with list import

possibility to import a list or copy/paste a list instead of creating each option 1 by 1. Would help on fields like the "Country" selection.

max_value error in text field.

Hi guys.

I've found that when we trying to set max length in text field plugin, we have an error "object of type 'int' has no len()", because of validators=[MaxLengthValidator(255)] in max_value field of FieldPluginBase, so, i think it should be replaced to MaxValueValidator or custom validator to check integer length.

Thanks.

Improve form creation process

When creating a form, we should first add a form container. Within this form container, the elements can be added.

The list currently allows for all options without having a wrapping

Form

Fieldset
Fields

validate email address in advanced form recipient input field

It would be good to validate the email address input field in the advanced from admin dialog, see screenshot: form advanced email fields

To be able to put anything in the input field is often a curse of problems where the page editor is not reciving any notification on form submit (even when the form user got a successful-send-email).

Custom css styles don't work

When I try to set a CSS style for any field type, it simply doesn't appear in the corresponding DOM element.

screen shot 2017-05-17 at 01 00 50

screen shot 2017-05-17 at 01 01 06

P.S. I have the latest version of Aldryn Forms.

RECIPIENTS

It would be good to send emails to non user emails, such as contacts@, quotes@, info@ and so on.

When using Multi Select Field the id has to refere to the first element

The label has the following entry:

<label class="label" for="id_aldryn-forms-field-1547">

and the list defines its own:

<ul><li><label for="id_aldryn-forms-field-1526_0"></label></li></ul>

this causes an html error as the reference from id_aldryn-forms-field-1547 is nowhere available.

Add robot protection with hidden fields

Should we add something like this to the forms to raise validation errors if an bot is trying to fill out the form additional or instead if using captchas?

class UnfillableField(forms.CharField):
    """
    A CharField raising a `forms.ValidationError` when filled.

    hide this field with css! E.g.

        .invisifi { display: none; }
    """
    widget = forms.TextInput(attrs={'class': 'invisifi'})

    def clean(self, value):
        if value:
            raise forms.ValidationError('Unknown error')


class UnfillableHiddenField(UnfillableField):
    """
    Like `UnfillableField` but with a `forms.HiddenInput` widget instead.
    """
    widget = forms.HiddenInput()
    hidden_widget = forms.HiddenInput()

It could be added to the wizard as optional fields or can be rendered into any generated form.

Suggestions?

ImportError: cannot import name 'patterns'

When we do:
python manage.py migrate

We see error:
File "/usr/local/lib/python3.5/site-packages/aldryn_forms/admin/base.py", line 58, in get_urls
from django.conf.urls import patterns, url
ImportError: cannot import name 'patterns'


When we open form submissions in Django-CMS admin - we see error:
render_to_string() got an unexpected keyword argument 'dictionary'

Environment:
Python: 3.5.2
Django: 1.10.5
Django-CMS: 3.4.2
aldryn-forms: from master

Unprotected submitted files and pictures in filer_public - make use of diavo/django-filer

Currently all files and pictures transmitted through aldryn-forms are stored somewhere within the media/filer_public folder, thus available unprotected to the public / everyone who knows or guesses the randomly created link.

Since django-filer is a requirement of aldryn-forms already and already capable of protecting files, I strongly suggest to make both add-ons collaborate to their full potential.

When installing the aldryn-forms add-on or even better at the individual form level, a choice should be given to have the submitted data protected from public access, i.e. accessible only when logged-in - this is crucial for many use cases with critical data!

Option to use e-mail field value in 'reply-to'

Many email gateway providers (including mandril and sparkpost) don't accept e-mail from unverified domains.

Therefore notification emails should not be sent with the sender being the e-mail field value. The sender address should be configurable (as it currently is through Aldryn Email Settings or settings.py). This email address can then be verified with the email gateway provider.

However to allow for easy responding in email clients, a reply-to header should be settable to the submitted email fields value.

remove ":" from checkbox labels

In this line, we add a : to the field label, this is ok for most fields, but on checkbox fields it looks weird since the checkbox is on the left side.

aldryn_forms_bug

replying to the sender email not to DEFAULT_FROM_EMAIL

Hi,

I have an issue with (reply_to). It is always replaying to the DEFAULT_FROM_EMAIL, but not to the email inserted by the user into the contact form.

Could you please provide an example of what should be changed to the original installation, in order to reply to the senders mail, and not to the DEFAULT_FROM_EMAIL?

I`m using Django 1.8.18 and aldryn-forms 2.2.9

Thanks in advance,

Mario

Why require redirect? and alert message only displayed to logged in users.

I'm working on a client site and have noticed that the grey alert that displays the success message after a form has been submitted is only being displayed to logged out users. Is there a way we can change this behavior?
grey-alert

Also the success message is briefly displayed in place of the form before the user gets redirected. I tried changing the Redirect To option to ----- but it's a required field on the form. This doesn't make a ton of sense? It would be ideal if we didn't even have the grey alert and just utilized the text that gets added in place of the form. Because as soon as the user gets redirected, this text is gone and the form is back because it's a fresh page load.
after-submit

So with the combination of these 2 issues, the user (being logged out) sees no confirmation that their form was sent.

'FormPlugin' object has no attribute 'email_notifications'

I have created a minimal EmailNotificationForm with a text field and a submit button. In the form admin's advanced settings, I've added one email notification.

Submitting the form causes the following error:

Request Method: POST
Request URL:    http://0.0.0.0:8000/de/kontakt/?edit
Django Version: 1.9.8
Exception Type: AttributeError
Exception Value:    
'FormPlugin' object has no attribute 'email_notifications'
Exception Location: /virtualenv/lib/python2.7/site-packages/aldryn_forms/contrib/email_notifications/cms_plugins.py in send_notifications, line 168
Python Version: 2.7.11

It seems that in line 168, instance is not of type EmailNotificationFormPlugin (the proxy model), but of type FormPlugin (the base model).

Missing form elements

  • Textarea (for example for leaving messages)
  • Radio fields (at least two required)
  • Checkbox fields
  • Upload field

refactor FormData model

We need a better way to store data in the model, to allow us to keep track of field positions in the form and labels, otherwise export becomes very tricky.

Braindump

Considering the user can move fields around and also change their labels, there's really no 100% accurate way of properly exporting the data, for example:

User creates form with field A and B then let's say 5 people submit the form, after the 5th person, the admin comes and modifies the form to add a new field C, then 5 more people submit the form. So since the new field C was introduced after the first 5 submissions, then the export file will NOT have a value for column C for the first 5 submissions, but it will for the other 5.

Now, since field C is a new field then somehow I need to know it exists and put this new field in the export file header, so to do this I rely on the latest form submitted of the chosen type and then use the fields on that form to build the export file header, I use the latest in order to keep up with user changes. In other words, the user can add / remove as many fields as they want, the export file will only reflect the state of the latest submitted form.

Also, if a field gets moved or changes it's label then there's sadly no way to match that field with it's value on export for forms that were submitted before the field change, this is because of a flaw on how the form data is stored.

Allow default selection

some form elements such as dropdown, checkboxes and radio fields should allow a default selection

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.