Skip to main content

Prevalidate Django Forms in the browser

Project description

django-formset – Better UX for Django Forms

<django-formset> is a Webcomponent used to wrap one or more Django Forms and/or ModelForms.

Example

Say, we have a standard Django Form:

from django.forms import forms, fields

class SubscribeForm(forms.Form):
    last_name = fields.CharField(
        label="Last name",
        min_length=2,
        max_length=50,
    )

    # ... more fields

then we rendering to HTML, we shall wrap that form into our special Webcomponent:

{% load django_formset %}

<django-formset endpoint="{{ request.path }}">
  <form name="subscribe">
    {% csrf_token %}
    {% render_groups form %}
  </form>
</django-formset>

this gives our Subscribe Form a much better User eXperience.

Features

  • Before submitting, our Form is prevalidated by the browser using the constraints we defined for each field.
  • Multiple FormData objects are submitted to an endpoint.
  • Server side validation errors are injected back to do form.
  • Much better user experience, since form data is sent using Ajax, rather than rerendering everything.

Documentation

Not deployed on RTD, but some documentation can be found in the docs folder.

Motivation

This library shall replace the form-validation framework in django-angular. In many aspects it already is far superior than the latter. Currently I am working on the Selectize-widget, which shall be used on Django's forms.models.ModelChoiceField and hence be used for db.models.ForeignKey.

Build Status PyPI PyPI version PyPI

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

django-formset-0.1.tar.gz (31.8 kB view details)

Uploaded Source

File details

Details for the file django-formset-0.1.tar.gz.

File metadata

  • Download URL: django-formset-0.1.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for django-formset-0.1.tar.gz
Algorithm Hash digest
SHA256 56a18efa815276b8ff7770a0db1e4896e3460c3d823b5f1f8a74db49e4adc0df
MD5 47be94aa45c4b46133248d78494364ce
BLAKE2b-256 9425c553057e8c5609f5125bf426f24025f45b7c8c2dc6254ba7ae204e4e45bb

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