Skip to main content

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

  1. Add "sweetautocomplete" to your INSTALLED_APPS setting::
INSTALLED_APPS = [
    ...
    'sweetautocomplete',
]
  1. Include the autocomplete URLconf in your project urls.py:
urlpatterns = [
    ...
    path("", include("sweetautocomplete.urls")),
    ...
]
  1. 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)
  1. 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

django_sweet_autocomplete-1.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django_sweet_autocomplete-1.2.0.tar.gz.

File metadata

File hashes

Hashes for django_sweet_autocomplete-1.2.0.tar.gz
Algorithm Hash digest
SHA256 77db05eb53a08aa1c90c733dd9f7e79b6518e6e8d43b884275d5f60e3e2f976e
MD5 19ec7a0e0563345a2e21612a43cb6a16
BLAKE2b-256 c22c06d9b940f9f70042e40f27a976b6d5e6bfb4190cfd1f840ffbc129237aaa

See more details on using hashes here.

File details

Details for the file django_sweet_autocomplete-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sweet_autocomplete-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e39a42a9b02f919f3828798c010a1f85ab9a37e634397c2717cb981bcf9ebf
MD5 0aa9f746bcd9767fa5a129b8b8b5a992
BLAKE2b-256 e975a13f0f175a892b24246dc6c10f55c7bd837c5c09392a8d55b43ea91b2362

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page