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
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
File details
Details for the file django_sweet_autocomplete-1.2.0.tar.gz
.
File metadata
- Download URL: django_sweet_autocomplete-1.2.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77db05eb53a08aa1c90c733dd9f7e79b6518e6e8d43b884275d5f60e3e2f976e |
|
MD5 | 19ec7a0e0563345a2e21612a43cb6a16 |
|
BLAKE2b-256 | c22c06d9b940f9f70042e40f27a976b6d5e6bfb4190cfd1f840ffbc129237aaa |
File details
Details for the file django_sweet_autocomplete-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: django_sweet_autocomplete-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e39a42a9b02f919f3828798c010a1f85ab9a37e634397c2717cb981bcf9ebf |
|
MD5 | 0aa9f746bcd9767fa5a129b8b8b5a992 |
|
BLAKE2b-256 | e975a13f0f175a892b24246dc6c10f55c7bd837c5c09392a8d55b43ea91b2362 |