https://github.com/zerc/django_molder
Another one painless way to work with Django forms and their fields
https://github.com/zerc/django_molder
Last synced: 5 months ago
JSON representation
Another one painless way to work with Django forms and their fields
- Host: GitHub
- URL: https://github.com/zerc/django_molder
- Owner: zerc
- License: bsd-3-clause
- Created: 2015-05-19T21:41:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-30T22:21:03.000Z (over 1 year ago)
- Last Synced: 2025-06-03T20:37:16.581Z (8 months ago)
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
===============================
Django Molder
===============================
.. image:: https://img.shields.io/pypi/v/django_molder.svg
:target: https://pypi.python.org/pypi/django_molder
.. image:: https://travis-ci.org/zerc/django_molder.svg?branch=master
:target: https://travis-ci.org/zerc/django_molder
:alt: Build status
* Free software: BSD license
Features
--------
It provides multiple tags to render Django form fields in a custom template.
Bootstrap3 classes and html as default but you can simply override extend this to fit your needs -
just make ``molder`` directory in your templates folder.
Example:
--------
In your template:
.. code:: html
{% loads molder_tags %}
{% 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" %}
{% render_field form_one.multiple_select_field show_help=False required=False %}
{% render_field form_one.checkbox_field %}
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 its first arg. Iterates through the fields and renders them. Extra kwargs passed to each field.
render_messages
===============
Just renders the messages (django.contrib.messages)