Skip to main content

A Django app to to create a responsive bootstrap-styled email-driven feedback form with a captcha and an email confirmation feature.

Project description

This app offers a way to create a responsive bootstrap-styled email-driven feedback form with a captcha and an email confirmation feature to your Django web-app hassle-free! The form itself is rendered on the page with the template tag while the form usage sessions are stored in the database. The initial validation and the UI manipulations are powered by JavaScript code which communicates with the server side via AJAX.

See the detailed documentation here.

Quick Start

  1. Install the package using pip:

    pip install django-bootstrap-feedback-form
  2. Add ‘feedback_form’ to the INSTALLED_APPS setting of your Django project like this:

    INSTALLED_APPS = [
        ...,
        'feedback_form',
    ]
  3. Include the URLconf of the app in your project urls.py something like this:

    path('feedback_form_urls/', include('feedback_form.urls')),
  4. Obtain and add to your project settings.py the reCaptcha v2 keys: the public one and the private one. Here and below shown a way to add such variables using python-dotenv (while you can technically define them just as is in your code, it is highly discouraged):

    RECAPTCHA_PUBLIC_KEY = getenv('RECAPTCHA_PUBLIC_KEY')
    RECAPTCHA_SECRET_KEY = getenv('RECAPTCHA_SECRET_KEY')
  5. Define the Django email backend in your project settings.py (as shown in the Django docs). Don’t forget to define EMAIL_TIMEOUT:

    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_USE_SSL = True
    EMAIL_TIMEOUT = 20
    EMAIL_HOST = getenv('EMAIL_HOST')
    EMAIL_PORT = getenv('EMAIL_PORT')
    EMAIL_HOST_USER = getenv('EMAIL_HOST_USER')
    EMAIL_HOST_PASSWORD = getenv('EMAIL_HOST_PASSWORD')
    DEFAULT_FROM_EMAIL = getenv('FROM_EMAIL')
    SERVER_EMAIL = getenv('SERVER_EMAIL')
  6. Define the FEEDBACK_EMAIL_INBOX variable with your desired email inbox to get messages:

    FEEDBACK_EMAIL_INBOX = getenv('FEEDBACK_EMAIL_INBOX')
  7. Define in one of your project apps a view with the named url (the url name parameter) being ‘form_redirect_address’ that will be visited by a user after the successful submission of the form. It is not necessary but strongly advised in order to avoid some troubles with the url resolving:

    path('some_url_idk/', some_view_idk, name='form_redirect_address'),
  8. Run python manage.py migrate feedback_form to create the app main model in the DB.

  9. Load and call the render_feedback_form template tag from the feedback_form tags module in a desired place of your Django template:

    {% load feedback_form %}
    {% render_feedback_form %}
  10. Launch the server and check that everything works fine.

Potential Problems and Liabilities

There are few problems and legal liabilities associated with using this application.

  1. It uses cookies. If you must make some notification to the user according to the laws in your jurisdiction, you should probably do it. Although these cookies pretty much should be considered strictly necessary and technical ones: they are used to identify a user and to prevent malfunction (and not in any form to spy or to collect some sensitive data), in some countries they still need to be stated.

  2. It sends a user data (especially an email address) over the SMTP protocol (or any other mean that you configure). This also may need some notice or something like that. Anyway, use only trusted SMTP providers.

  3. If you use the mail_admins built-in Django logging handler (or something with a similar functionality), you may accidentally send a sensitive data (like an email or ip address) through the email. The @sensitive_variables decorator is used for every form-related view here to sanitize the data, but there’s no warranty. This is applicable to all Django apps unfortunately.

  4. Therefore, if applicable, you may need to establish some Privacy Policy / Terms of Service or something like that on your site or app.

  5. Also some SMTP services tend to not return an errors even if sending the letter goes wrong. That means that it’s impossible to catch the issues of that kind on the backend (or at least it is not optimal to do so). But it mainly affects some none-existing email address or host, so it should not affect the full cycle of the form submission (because of the email address confirmation feature), so it’s probably fine. Probably.

For the detailed usage and customization suggestions consult the docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-bootstrap-feedback-form-1.0.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-bootstrap-feedback-form-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django-bootstrap-feedback-form-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a534b90d6ce182c167ebb86cc693ffca772538a136033d62ebb8de00b83531a2
MD5 4ffd1d6dbf59be924425f2a328f7f78c
BLAKE2b-256 2059267e3ffa931db438559c2102e2a4606cddd97c6c6ee8e27520ae6e47a02d

See more details on using hashes here.

File details

Details for the file django_bootstrap_feedback_form-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_bootstrap_feedback_form-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5013c8beb663ca4e280602a0154b3a14e1de9deed0a354aa445e62ebb70cad3c
MD5 273e0f1e667d92475968d43b91be19ea
BLAKE2b-256 7f904d80b371c9f36c07a9b8afecb75e3c9e41c3b27a1ffd81b969632dd96295

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page