django-model-admin-autocomplete-0.2.0
توضیحات
Tweaks for existing built-in Django"s autocomplete feature
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | django-model-admin-autocomplete-0.2.0 |
| نام | django-model-admin-autocomplete |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Jerin Peter George |
| ایمیل نویسنده | jerinpetergeorge@gmail.com |
| آدرس صفحه اصلی | https://github.com/jerinpetergeorge/django-model-admin-autocomplete |
| آدرس اینترنتی | https://pypi.org/project/django-model-admin-autocomplete/ |
| مجوز | MIT-Zero |
===============================
django-model-admin-autocomplete
===============================
This simple django app enables users to do a few tweaks to `Django's built-in autocomplete <https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields>`_ 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,
.. code-block:: python
# 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.
.. code-block:: python
# 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 <https://github.com/jerinpetergeorge/model-admin-autocomplete-demo>`__.
نحوه نصب
نصب پکیج whl django-model-admin-autocomplete-0.2.0:
pip install django-model-admin-autocomplete-0.2.0.whl
نصب پکیج tar.gz django-model-admin-autocomplete-0.2.0:
pip install django-model-admin-autocomplete-0.2.0.tar.gz