Autocompletion for django-tagging
Project description
django-tagging-autocomplete is a jquery based autocomplete solution for django-tagging.
Requirements
django-tagging
Setup
Download package and install, for example using pip:
pip install django-tagging-autocomplete
Add tagging_autocomplete to installed apps in your project’s settings.
Add the following line to your project’s urls.py file:
(r'^tagging_autocomplete/', include('tagging_autocomplete.urls')),
Usage
The Model Field
You can use TagAutocompleteField() to enable autocompletion right in your models.py. In most cases this is the easiest solution:
from django.db import models from tagging_autocomplete.models import TagAutocompleteField class SomeModel(models.Model): tags = TagAutocompleteField()
The Form Widget
Alternatively you can use the TagAutocomplete() form widget while creating your form:
from django import forms from tagging.forms import TagField from tagging_autocomplete.widgets import TagAutocomplete class SomeForm(forms.Form): tags = TagField(widget=TagAutocomplete())
Optional settings
By default the maximum number of results suggested by the autocompletion is 100. You can modify this number by adding to your settings.py project file the TAGGING_AUTOCOMPLETE_MAX_RESULTS constant. For example:
TAGGING_AUTOCOMPLETE_MAX_RESULTS = 5
By default autocompletion suggests tags that start with a given term. In case you need to show ones that contain the given term, set TAGGING_AUTOCOMPLETE_SEARCH_CONTAINS to True. For example:
TAGGING_AUTOCOMPLETE_SEARCH_CONTAINS = True
By default suggestions are shown right after you enter first character. You can configure this behaviour using TAGGING_AUTOCOMPLETE_MIN_LENGTH. For example:
TAGGING_AUTOCOMPLETE_MIN_LENGTH = 3
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
Built Distribution
Hashes for django-tagging-autocomplete-0.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1bccc0c24504fdd3bf764feb165a0ddf527a2377bec314ac0c310be0833188 |
|
MD5 | 1a9581acf8af4717e28b67dc2695bd3b |
|
BLAKE2b-256 | 54838a8b307ad517f51a231844dfd8a6101e00ac094fda91ffa42b45386121ef |
Hashes for django_tagging_autocomplete-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97d8783f0bc031b5ce984d0a34d53e07c53e58ba41a60706a7d50afe683eb1c6 |
|
MD5 | ad9dea23fb0133230d2a0c0d69c0aa51 |
|
BLAKE2b-256 | 3b4b1188d50a8a6dbd5c46359fc0c93f9a862a75060683ef5608e425f0ef0428 |