Metadata-Version: 2.1
Name: django-sweet-autocomplete
Version: 1.2.0
Summary: Simplify autocomplete functionalities implementation in your Django project.
Home-page: https://github.com/kubeljk/django-sweet-autocomplete
Author: Klemen Kubelj
Author-email: klemen.kubelj@gmail.com
License: MIT
Keywords: django autocomplete
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
Requires-Dist: Django>=3.2
Requires-Dist: djangorestframework>=3
Requires-Dist: psycopg2-binary>=2.8

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::
```python
INSTALLED_APPS = [
    ...
    'sweetautocomplete',
]
```

2. Include the autocomplete URLconf in your project `urls.py`:
```python
urlpatterns = [
    ...
    path("", include("sweetautocomplete.urls")),
    ...
]

```

3. Create a file called `autocomplete.py` in your app:
```python
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)
```

4. Use autocomplete endpoints in your templates:
```html
"{% url 'autocomplete' 'model_name' %}?query=..."
```
