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
Built Distribution
Close
Hashes for django-sweet-autocomplete-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66cc7ab7353feca8f7dec47ee19617b3e21eddf93f910aef4cc301674b718060 |
|
MD5 | 5a3da64cd5aa8465ca8c50eab026e292 |
|
BLAKE2b-256 | 88bd44883521baa43e5d675a9852adf42615f35b548c4cdc819c2771a96602ac |
Close
Hashes for django_sweet_autocomplete-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f35dedeb91161ad7350d98deda6fecd6524f5f04a80d2ca4c8aaaade08393ee5 |
|
MD5 | 87258ee8d137e270ef77b830598710ae |
|
BLAKE2b-256 | 5ba59f98eac85ffd1245b66aa3e9dea56b22638e6e920556c786de14f1a86834 |