not_editable_admin

camelot.admin.not_editable_admin.not_editable_admin(original_admin, actions=False, editable_fields=[], deep=True)[source]

Class decorator to make all fields read-only.

Parameters:
  • original_admin – an camelot.admin.object_admin.ObjectAdmin class (not an instance)
  • actionsTrue if the new admin should have its actions enabled, defaults to False
  • editable_fields – list of fields that should remain editable, if they are editable in the original admin.
  • deep – indicates if Admin classes related to this admin should become read-only as well. This makes other objects pointed to by OneToMany and ManyToOne fields read only.
Returns:

a new admin class, with read only fields. The new admin class is a subclass of the original class.

usage

class Movie(Entity):
    name = Field(Unicode(50))
    contributions = Field(Unicode(255))

    class Admin(EntityAdmin):
        list_display = ['name', 'contributions]

    Admin = not_editable_admin( Admin, 
                                editable_fields=['contributions'] )

Previous topic

menu

Next topic

object_admin

This Page