Skip to main content

Django-simple-form is a simple way to build your forms in HTML-level

Project description

Django-simple-form is a simple way to build your forms in HTML-level.

Installation

You can get Django simple form by using pip:

$ pip install django-simple-form

To enable the package you need to add it to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'simple_form',
    ...
]

Usage

Render all fields form:

{% load simple_form %}

...

{{ form|render_form }}

Render field by field:

{% load simple_form %}

...

{{ form.name|render_field }}
{{ form.email|render_field }}

Custom the template

Create a folder with name simple_form in your template dir:

templates/
    ...
    simple_form/
        field.html
        ...

In HTML file you define the structure for each field the form:

<div>
  <label for="{{ field.auto_id }}">
    {{ field.label }}
  </label>

  {{ field }}

  {% if field.errors %}
    {% for error in field.errors %}
      <span>{{ error }}</span>
    {% endfor %}
  {% endif %}
</div>

{% if field.help_text %}
  <p title="{{ field.help_text }}">
    {{ field.help_text }}
  </p>
{% endif %}

If you need to customize the rendering for the type field, create an HTML file to the specific type of his widget:

templates/
    ...
    simple_form/
        field.html
        checkboxinput.html
        ...

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-simple-form-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

django_simple_form-0.0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file django-simple-form-0.0.2.tar.gz.

File metadata

  • Download URL: django-simple-form-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.2

File hashes

Hashes for django-simple-form-0.0.2.tar.gz
Algorithm Hash digest
SHA256 03a7be73e01201d8d7fd693944f4e48363fdff0a85c38da42f6727c292b9c664
MD5 da6748143e113f5c18b643750e3f6f64
BLAKE2b-256 f1cd76ee113f2f0b35aebd7362918f8579dce457cce643d980c762cb6ad9a2bf

See more details on using hashes here.

File details

Details for the file django_simple_form-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_simple_form-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae38f1d32f6a5c8751d95679b607c18ffc0db0f229b491d025e5928c4ea15112
MD5 790d0729296b5aacab43174ed3a826a5
BLAKE2b-256 d822a288448f7e6f0483d427c190fa3f5d925500b450ae4888abb1908cb37044

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