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"]
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
Close
Hashes for django-model-admin-autocomplete-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a279487c96d1cb3f891f95d02e8873b796649c3feccc2d153b4ae40556a06678 |
|
MD5 | a01865e0548a578007fb932bc50b4389 |
|
BLAKE2b-256 | 51c1cebe5a143d2edde66524934e77db99cd585b72c7be9ef2475c84b21661e5 |
Close
Hashes for django_model_admin_autocomplete-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02f7fedd543a8cccd9a5fa41af72b35bf1b5a3a4c508bec0f86af519e31f4f6a |
|
MD5 | 419d20c65a3b6522098b3dbcd4d363db |
|
BLAKE2b-256 | 050b5adc2e97c1a5349fcd423f2bee396027f58905608b045bc83d877f60fcea |