Source code for superdjango.db.eav.admin

from django.contrib import admin
# from django.utils.translation import ugettext_lazy as _

__all__ = (
    "BaseAttributeModelAdmin",
    "BaseAttributeModelInline",
    "BaseValueModelInline",
)

# Inlines


[docs]class BaseAttributeModelInline(admin.StackedInline): """Base inline for including attributes fields.""" extra = 0
[docs] def get_fields(self, request, obj=None): return [ "label", "name", "help_text", "data_type", "choices", "content_type", "limit_choices_to", "max_length", "min_length", "decimal_places", "max_digits", "raw_default_value", "sort_order", "is_hidden", ]
[docs]class BaseValueModelInline(admin.TabularInline): """Base inline for specifying an attribute value.""" extra = 0
[docs] def get_fields(self, request, obj=None): return [ "raw_value", ]
# Models
[docs]class BaseAttributeModelAdmin(admin.ModelAdmin): """Base admin for an attribute model."""
[docs] def get_fields(self, request, obj=None): return [ "label", "name", "help_text", "data_type", "choices", "content_type", "limit_choices_to", "max_length", "min_length", "decimal_places", "max_digits", "raw_default_value", "sort_order", "is_hidden", ]
[docs] def get_list_display(self, request): return [ "label", "is_required", "help_text", "data_type", ]