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
View page that display all reports about this certain entity / records creating a dashboard out of the box.
Comes with settings in place for reversion
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
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.
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]
-
- 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:
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.
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