https://github.com/c-bata/django-label-tag-attr
Add css classes and html tag attributes to django form's label.
https://github.com/c-bata/django-label-tag-attr
Last synced: about 1 year ago
JSON representation
Add css classes and html tag attributes to django form's label.
- Host: GitHub
- URL: https://github.com/c-bata/django-label-tag-attr
- Owner: c-bata
- License: mit
- Created: 2015-03-28T04:51:19.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-07T15:18:29.000Z (almost 11 years ago)
- Last Synced: 2025-03-12T14:48:43.494Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 211 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
=====================
django-label-tag-attr
=====================
.. image:: https://travis-ci.org/c-bata/django-label-tag-attr.svg
:target: https://travis-ci.org/c-bata/django-label-tag-attr
.. image:: https://badge.fury.io/py/django-label-tag-attr.svg
:target: http://badge.fury.io/py/django-label-tag-attr
Add css classes and html tag attributes to form's label in django templates.
This library can render a form label like `django-widget-tweaks `_
The license is MIT.
Installation
============
::
$ pip install django-label-tag-attr
Then add 'label_tag_attr' to INSTALLED_APPS.
Usage
=====
Previous(Use django-widget-tweaks only)
---------------------------------------
.. code-block:: html
{% load widget_tweaks %}
{{ form.text.label }}
{% render_label form.text class="form-control" %}
Use django-label-tag-attr
-------------------------
``render_label`` template tag for customizing form's label by using an HTML-like syntax.
.. code-block:: html
{% load label_tag_attr %}
{% load widget_tweaks %}
{% render_label form.text class="control-label" %}
{% render_field form.text class="form-control" %}
Resources
=========
* `Github `_
* `PyPI `_