Simplify autocomplete functionalities implementation in your Django project.
Project description
Django Sweet Autocomplete
The purpose of Sweet Autocomplete is to simplify autocomplete functionalities implementation in your Django project.
Quick start
- Add "sweetautocomplete" to your INSTALLED_APPS setting::
INSTALLED_APPS = [
...
'sweetautocomplete',
]
- Include the autocomplete URLconf in your project
urls.py
:
urlpatterns = [
...
path("", include("sweetautocomplete.urls")),
...
]
- Create a file called
autocomplete.py
in your app:
from sweetautocomplete.autocomplete import autocompletefactory, AbstractAutocomplete
from .models import MyModel
class MyModelAutocomplete(AbstractAutocomplete):
model = MyModel
field = "field_name"
class Serializer(serializers.ModelSerializer):
label = serializers.CharField(source="field_name")
class Meta:
model = MyModel
fields = ["label"]
autocompletefactory.register("model_name", MyModelAutocomplete)
- Use autocomplete endpoints in your templates:
"{% url 'autocomplete' 'model_name' %}?query=..."
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-sweet-autocomplete-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c13adb95636e9b1f911f31410c0e3b92c8b9f6585c86a3089f7cabf3cebc9a0 |
|
MD5 | f6749f66401a60b0a95551a5981e0060 |
|
BLAKE2b-256 | 354838e58ab2c3318ac53437c7c2f2a2150038a037387786669342c77d213d3e |