Tweaks for existing built-in Django"s autocomplete feature
Project description
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', 'admin.E040']
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.
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
File details
Details for the file django-model-admin-autocomplete-0.2.0.tar.gz
.
File metadata
- Download URL: django-model-admin-autocomplete-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef7ed9b0d6cd2bc231c0c059f544846bef95504c72db23419de71d91b7b9e9c2 |
|
MD5 | f23eefab8a4cc7e8e40d5dd666ffbc74 |
|
BLAKE2b-256 | 628df7aa8551632d97dcc710910b651bdb27ddcc0c0af440d7723796dbef6c4d |
File details
Details for the file django_model_admin_autocomplete-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: django_model_admin_autocomplete-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 596d34da731a543ddbc38aacdd7af06dfab936feb79e9e24787dc04645fb24d4 |
|
MD5 | 9fa38bcb051909c9bcaecef6da4ad99f |
|
BLAKE2b-256 | 8865c071fe0747808f269a240b3d36755720425b23d8ed44f0f4e74c9dea7519 |