Модуль реализует механизм примесей (mixin) для Django admin.
Project description
django admin mixin
Модуль реализует механизм примесей (mixin) для Django admin. С помощью модуля можно упростить конфигурацию admin.py
Применение:
Если у вас есть много моделей, которые имеют повторяющиеся поля. С этими полями как-то надо работать в админке, например, фильтровать, искать по ним. То вы можете вынести этот повторяющийся блок в mixin.
Free software: MIT license
Documentation: https://django-admin-mixin.readthedocs.io.
Install
pip install django-admin-mixin
Configuration
Usage
Example models:
# models.py class SuperModel1(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) value1 = models.CharField(max_length=25) value2 = models.FloatField() class SuperModel2(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) super_val1 = models.CharField(max_length=120) super_val2 = models.FloatField()
Example admin.py:
# admin.py from django.contrib import admin from super_app.models import SuperModel1, SuperModel2 from django_admin_mixin import MixinAdminCombiner class TimeMixinAdmin(admin.ModelAdmin): list_display = ['created_at'] ordering = ['-created_at'] list_filter = ['created_at', 'updated_at'] @admin.register(SuperModel1) class SuperModel1Admin(MixinAdminCombiner): mixins = [TimeMixinAdmin, ] list_display = ['value1'] @admin.register(SuperModel2) class SuperModel2Admin(MixinAdminCombiner): mixins = [TimeMixinAdmin, ] list_display = ['super_val1', 'super_val2']
Result:
<image>
Features
TODO
History
0.1.0 (2016-09-24)
First release on PyPI.
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-admin-mixin-0.1.1.tar.gz
.
File metadata
- Download URL: django-admin-mixin-0.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73c152d9cb7d11e1743869562c410ca422b6ea5320b9e93559a9c59d121c5c4e |
|
MD5 | 2d7d56ecd6a58069f0e540ac7c090290 |
|
BLAKE2b-256 | 0e24cada51df556c291e059386e68e629eeb98bbe88ae7d1beea5061a1b64dbc |
Provenance
File details
Details for the file django_admin_mixin-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_admin_mixin-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26fa31b2a226d9d6c128a0aa02727644755b7e3a1b31fdfbc3e64a00ea6b2033 |
|
MD5 | ee99191c57dfb028d0ad37c3d9d8edff |
|
BLAKE2b-256 | ee4735f2dabd7013950333f255b17ff155ecbec3e94dea30dceb324a40a0c720 |