API Reference


class eav.admin.BaseEntityAdmin(model, admin_site)

Base class for entity admin classes.

render_change_form(request, context, **kwargs)

Wrapper for ModelAdmin.render_change_form. Replaces standard static AdminForm with an EAV-friendly one. The point is that our form generates fields dynamically and fieldsets must be inferred from a prepared and validated form instance, not just the form class. Django does not seem to provide hooks for this purpose, so we simply wrap the view and substitute some data.

class eav.admin.BaseSchemaAdmin(model, admin_site)

Base class for schema admin classes.

class eav.admin.BaseEntityInline(parent_model, admin_site)

Inline model admin that works correctly with EAV attributes. You should mix in the standard StackedInline or TabularInline classes in order to define formset representation, e.g.:

class ItemInline(BaseEntityInline, StackedInline):
    model = Item
    form = forms.ItemForm

alias of BaseEntityInlineFormSet


class eav.fields.RangeField(*args, **kwargs)

A multi-value field which consists of tho float fields.


alias of RangeWidget


class eav.forms.BaseSchemaForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None)

Base class for schema forms.


Avoid name clashes between static and dynamic attributes.

class eav.forms.BaseDynamicEntityForm(data=None, *args, **kwargs)

ModelForm for entity with support for EAV attributes. Form fields are created on the fly depending on Schema defined for given entity instance. If no schema is defined (i.e. the entity instance has not been saved yet), only static fields are used. However, on form validation the schema will be retrieved and EAV fields dynamically added to the form, so when the validation is actually done, all EAV fields are present in it (unless Rubric is not defined).


Returns True if dynamic attributes can be added to this form. If False is returned, only normal fields will be displayed.


Saves this form‘s cleaned_data into model instance self.instance and related EAV attributes.

Returns instance.

Object Managers


class eav.widgets.RangeWidget(attrs=None)

Represents a range of numbers.