Skip to main content

Another one painless way to working with forms and they fields

Project description

https://img.shields.io/pypi/v/django_molder.svg

Another one painless way to working with forms and they fields

  • Free software: BSD license

Features

It provides multiple tags for rendering form fields in a custom template. Bootstrap3 classes and html as default but you can simple override this for your specification - just make molder directory in your templates folder.

Example:

In your template:

{% loads molder_tags %}

<div class="container-fluid">
    <div class="row">
        <form class="form">
            <div class="col-md-6">
                {% render_field form_one.char_field class="+big_input" placeholder="Hello world" %}
                {% render_field form_one.radio_field help_on_top=True %}
                {% render_field form_one.file_field template="myapp/coolest_file_field.html" %}
            </div>
            <div class="col-md-6">
                {% render_field form_one.multiple_select_field show_help=False required=False %}
                {% render_field form_one.checkbox_field %}
            </div>
        </form>
    </div>
</div>

Template tags

render_field

Gets the bound_field and the extra kwargs and then render it.

Special kwargs:

  • show_help - show/hide field help_text

  • show_label - show/hide field label

  • help_on_top - show help_text on top

  • template - template used for this field

  • required - override field required attr for visual fake

render_form

Gets form as first arg. Iterates through the fields and render them. Extra kwargs passed in each field.

render_messages

Just render the messages (django.contrib.messages)

History

0.1.0a (2015-01-11)

  • README fix

0.1.0 (2015-01-11)

  • First release on PyPI.

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_molder-0.1.0a.tar.gz (15.0 kB view hashes)

Uploaded Source

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