The Admin

Django ERP framework Site

Django ERP framework Site is a custom admin site. It provide you the theme and other goodies aimed to make developement of ERP solutions easier. It’s use is optional.

ModelAdmin Classes

A subclass of admin.ModelAdmin with various different options

  1. View page that display all reports about this certain entity / records creating a dashboard out of the box.

  2. Comes with settings in place for reversion

  3. Usually if a User if given a permission on Model, it means that they have same permissions to its inline models. Example: User who can add invoice, is of course permitted to add its inline details. | This option can be switched off by setting permission_override_model on the TransactionInline AdminModel

EntityAdmin offer two important hooks to manage little bit complicated flow

  1. it offer EntityAdmin.pre_save(self, form, formsets, change) It offers you a hook before saving the whole page to do any management you want. Like saving the total of the invoicelines in the Invoice.value field.

  2. whole_changeform_validation(self, request, form, formsets, change, **kwargs)() Where you’ll get a chance to validate the whole page forms and formsets

EntityAdmin

class erp_framework.admin.admin.EntityAdmin(*args, **kwargs)[source]
changelist_view(request, extra_context=None)[source]

The ‘change list’ admin view for this model.

formfield_for_dbfield(db_field, request, **kwargs)[source]

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

get_actions(request)[source]

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

get_list_display(request)[source]

Return a sequence containing the fields to be displayed on the changelist.

post_save(request, new_object, form, formsets, change)[source]

Hook for doing any final logic after saving :param form: :param formsets: :param change: :return:

pre_save(form, formsets, change)[source]

Hook for doing any final computation setting before saving :param form: :param formsets: :param change: :return:

reversion_register(model, **kwargs)[source]

Registers the model with reversion.

save_model(request, obj, form, change)[source]

Given a model instance save it to the database.

whole_changeform_validation(request, form, formsets, change, **kwargs)[source]

A Hook for validating the whole changeform :param form: the ModelAdmin Form :param formsets: inline formsets :param kwargs: extra kwargs :return: True for valid [default] False for Invalid

TransactionAdmin

class erp_framework.admin.admin.TransactionAdmin(*args, **kwargs)[source]
formfield_for_dbfield(db_field, request, **kwargs)[source]

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

get_list_filter(request)[source]

Return a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page.

save_formset(request, form, formset, change)[source]

Given an inline formset save it to the database.

TransactionItemAdmin

class erp_framework.admin.admin.TransactionItemAdmin(parent_model, admin_site)[source]
formfield_for_dbfield(db_field, request, **kwargs)[source]

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.

get_permission_override_model(request, **kwargs)[source]

Return a string reprsentation of the model to look into its permissions, :param request: :param kwargs: :return:

get_ra_permission_codename(action, model_name)[source]

Returns the codename of the permission for the specified action.

has_add_permission(request, obj=None)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.

has_delete_permission(request, obj=None)[source]

Return True if the given request has permission to delete the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

view_on_site = False

To simplify complex forms with inline , making inline permission reflect base form permission permission_override_model can be True, False , str Or ModelBase