Skip to main content

django admin mixin

https://img.shields.io/pypi/v/django_admin_mixin.svg https://img.shields.io/travis/WarmongeR1/django_admin_mixin.svg Documentation Status Updates

Модуль реализует механизм примесей (mixin) для Django admin. С помощью модуля можно упростить конфигурацию admin.py

Применение:

Если у вас есть много моделей, которые имеют повторяющиеся поля. С этими полями как-то надо работать в админке, например, фильтровать, искать по ним. То вы можете вынести этот повторяющийся блок в mixin.

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.

Metadata

Release files for django-admin-mixin 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-mixin 0.1.2
File Size Uploaded
django-admin-mixin-0.1.2.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-mixin 0.1.2
File Interpreter ABI Platform
django_admin_mixin-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 19.9 kB

Release files / django-admin-mixin-0.1.2.tar.gz

Download URL django-admin-mixin-0.1.2.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c4c8c1197d68c47dd77e22aeec913d47dcbd5f347c60c564cdcd88f7a6702c29
BLAKE2b-256 checksum
How to use checksums
fb32d1ce15191f6378620e060a14f2fc651b0afdd311747c06ad964e0ab4155b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_admin_mixin-0.1.2-py2.py3-none-any.whl

Download URL django_admin_mixin-0.1.2-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
89fdd003e4a12648fc16822157e70330896ffd83de0757fc3013aebf856487d8
BLAKE2b-256 checksum
How to use checksums
10fa3c5adf46d086829598af5f64cc902e0dd38ab2d608e4fa83314215a74611
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page