Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bennylope/django-taggit-labels
Clickable label widget for django-taggit
https://github.com/bennylope/django-taggit-labels
django python tags
Last synced: 12 days ago
JSON representation
Clickable label widget for django-taggit
- Host: GitHub
- URL: https://github.com/bennylope/django-taggit-labels
- Owner: bennylope
- License: bsd-3-clause
- Created: 2014-06-07T20:48:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T18:46:02.000Z (over 1 year ago)
- Last Synced: 2024-04-14T04:51:12.755Z (7 months ago)
- Topics: django, python, tags
- Language: Python
- Homepage:
- Size: 152 KB
- Stars: 68
- Watchers: 6
- Forks: 25
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
====================
django-taggit-labels
====================.. image:: https://badge.fury.io/py/django-taggit-labels.svg
:target: https://badge.fury.io/py/django-taggit-labelsLabel widget(s) for `django-taggit `_.
Now instead of this:
.. image:: https://raw.githubusercontent.com/bennylope/django-taggit-labels/master/docs/taggit-text.png
You can use this:
.. image:: https://raw.githubusercontent.com/bennylope/django-taggit-labels/master/docs/taggit-labels.png
Overview
--------This is a widget for use in the Django admin interface, and it depends on
Django's namespaced jQuery. It allows you to add and remove tags by selecting
or deselecting visual labels.The label widget does not expose the input field so that you can add new tags. The
base label widget instead shows all available tags and lets you pick between
them in Django's admin interface. It presumes that you are using a managed (or
'curated' if you're feeling insufferable) tag list.Quickstart
----------Install django-taggit-labels:
.. code-block:: bash
pip install django-taggit-labels
Add `taggit_labels` to your project:
.. code-block:: python
INSTALLED_APPS = (
'taggit',
'taggit_labels',
)Use the label widget:
.. code-block:: python
from taggit.forms import TagField
from taggit_labels.widgets import LabelWidgetclass ContentForm(forms.ModelForm):
tags = TagField(required=False, widget=LabelWidget)Just use this form class for your `ModelAdmin
`_
class now:.. code-block:: python
class ContentAdmin(admin.ModelAdmin):
form = ContentAdminFormYou can use the widget with `your own tag model
`_, too:.. code-block:: python
from taggit.forms import TagField
from taggit_labels.widgets import LabelWidgetclass ContentForm(forms.Form):
tags = TagField(required=False, widget=LabelWidget(model=MyTag))The `tag` model from taggit will be presumed if you do not specify a tag model.