Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 14 days ago
JSON representation

Add css classes and html tag attributes to django form's label.

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 `_