- This simple django app enables users to do a few tweaks to Django’s built-in autocomplete
feature.
Installation
pip install django-model-admin-autocomplete
and then add this to your settings.py module
SILENCED_SYSTEM_CHECKS = ["admin.E039"]
Usage
Consider you have a few models as,
# models.py
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateField()
publications = models.ManyToManyField(Publication)
reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)
def __str__(self):
return self.headline
and you need autocomplete fields for publications and reporter in models admin.
# admin.py
from django.contrib import admin
from .models import Article
from model_admin_autocomplete import ModelAdminAutoComplete
class ArticleModelAdmin(ModelAdminAutoComplete, admin.ModelAdmin):
autocomplete_fields = ('publications', 'reporter')
admin.site.register(Article, ArticleModelAdmin)
Demo
If you want to see a very simple Django demo project using this module, please take a look at model-admin-autocomplete-demo.
Release files for django-model-admin-autocomplete 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-model-admin-autocomplete-0.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_model_admin_autocomplete-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / django-model-admin-autocomplete-0.1.0.tar.gz
| Download URL | django-model-admin-autocomplete-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a279487c96d1cb3f891f95d02e8873b796649c3feccc2d153b4ae40556a06678
|
|
BLAKE2b-256 checksum How to use checksums |
51c1cebe5a143d2edde66524934e77db99cd585b72c7be9ef2475c84b21661e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Release files / django_model_admin_autocomplete-0.1.0-py3-none-any.whl
| Download URL | django_model_admin_autocomplete-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02f7fedd543a8cccd9a5fa41af72b35bf1b5a3a4c508bec0f86af519e31f4f6a
|
|
BLAKE2b-256 checksum How to use checksums |
050b5adc2e97c1a5349fcd423f2bee396027f58905608b045bc83d877f60fcea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|