Skip to main content

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.


pip install django-model-admin-autocomplete

and then add this to your module

SILENCED_SYSTEM_CHECKS = ['admin.E039', 'admin.E040']


Consider you have a few models as,

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.

from django.contrib import admin
from .models import Article
from model_admin_autocomplete import ModelAdminAutoComplete

class ArticleModelAdmin(ModelAdminAutoComplete, admin.ModelAdmin):
    autocomplete_fields = ('publications', 'reporter'), ArticleModelAdmin)


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-model-admin-autocomplete, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size django_model_admin_autocomplete-0.2.0-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-model-admin-autocomplete-0.2.0.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page