### Navigation

- index
- modules |
- Camelot documentation »

# admin Package

## `admin` Package

@TODO: rewrite docstring

Admin classes, specify how objects should be rendered in the gui

An admin class has class attributes like ‘list_display’ which contains the columns that should be displayed in a list view (again, see Django)

So this ‘list_display’ attribute can be overwritten in the Admin class for each model.

But for the gui generation itself, we don’t use the class attributes, but we use methods, like ‘getColumns’, that way, we can make the gui very specific, on the context

## `application_admin` Module

class `camelot.admin.application_admin.``ApplicationAdmin`

  Bases: `PyQt4.QtCore.QObject`

  The ApplicationAdmin class defines how the application should look like, it also ties Python classes to their associated `camelot.admin.object_admin.ObjectAdmin` class or subclass. It’s behaviour can be steered by overwriting its static attributes or it’s methods :

  `name`

    The name of the application, as it will appear in the title of the main window.

  `application_url`

    The url of the web site where the user can find more information on the application.

  `help_url`

    Points to either a local html file or a web site that contains the documentation of the application.

  `author`

    The name of the author of the application

  `domain`

    The domain name of the author of the application, eg ‘mydomain.com’, this domain will be used to store settings of the application.

  `version`

    A string with the version of the application

  `backup_mechanism`

    A subclass of `camelot.core.backup.BackupMechanism` that enables the application to perform backups an restores.

  `database_profile_wizard`

    The wizard that should be used to create new database profiles. Defaults to `camelot.view.database_selection.ProfileWizard`

  `database_selection`

    if this is set to True, present the user with a database selection wizard prior to starting the application. Defaults to `False`.

  `actions_changed_signal`
  `admins` = {}
  `application_url` = None
  `author` = 'Conceptive Engineering'
  `backup`(main_window)
  `backup_mechanism`

    alias of `BackupMechanism`

  `create_main_window`()

    Create the main window that will be shown when the application starts up. By default, returns an instance of

    > `camelot.view.mainwindow.MainWindow`

    Returns: | a `PyQt4.QtGui.QWidget`

  `database_profile_wizard`

    alias of `ProfileWizard`

  `database_selection` = False
  `domain` = 'python-camelot.com'
  `dump_state`()

    Dump the state of the application to the output, this method is triggered by pressing `Ctrl-Alt-D` in the GUI

  `get_about`()

    Returns: | the content of the About dialog, a string with html

    syntax

  `get_actions`()

    Returns: | a list of `camelot.admin.application_action.ApplicationAction` objects

    that should be added to the menu and the icon bar for this application

  `get_affiliated_url`()

    Returns: | a `PyQt4.QtCore.QUrl` pointing to an affiliated webpage

    When this method returns a QUrl, an additional item will be available in the ‘Help’ menu, when clicked the system browser will be opened an pointing to this url.

    This can be used to connect the user to a website that is used a lot in the organization, but hard to remember.

  `get_default_field_attributes`(type_, field)

    Returns the default field attributes

  `get_entity_admin`(entity)

    Get the default `camelot.admin.object_admin.ObjectAdmin` class for a specific entity, return None, if not known. The ObjectAdmin should either be registered through the `register()` method or be defined as an inner class with name `Admin` of the entity.

    Parameters: | entity – a `class`

    deprecated : use get_related_admin instead

  `get_help_url`()

    Returns: | a `PyQt4.QtCore.QUrl` pointing to the index page for help

  `get_icon`()

    Returns: | the `camelot.view.art.Icon` that should be used for the application

  `get_name`()

    Returns: | the name of the application, by default this is the class

    attribute name

  `get_organization_domain`()
  `get_organization_name`()
  `get_related_admin`(cls)

    Get the default `camelot.admin.object_admin.ObjectAdmin` class for a specific class, return None, if not known. The ObjectAdmin should either be registered through the `register()` method or be defined as an inner class with name `Admin` of the entity.

    Parameters: | entity – a `class`

  `get_remote_support_url`()

    Returns: | a `PyQt4.QtCore.QUrl` pointing to a page to get remote support

    When this method returns a QUrl, an additional item will be available in the ‘Help’ menu, when clicked the system browser will be opened an pointing to this url.

    This can be used to connect the user to services like logmein.com, an online ticketing system or others.

  `get_sections`(*args, **kwargs)

    A list of `camelot.admin.section.Section` objects, these are the sections to be displayed in the left panel.

  `get_splashscreen`()

    Returns: | a `PyQt4.QtGui.QPixmap` to be used as splash screen

  `get_stylesheet`()

    Returns: | a string with the qt stylesheet to be used for this application as a string

    or None if no stylesheet needed.

    Camelot comes with a couple of default stylesheets :

    > - stylesheet/office2007_blue.qss
    > - stylesheet/office2007_black.qss
    > - stylesheet/office2007_silver.qss

    Have a look at the default implementation to use another stylesheet.

  `get_translator`()

    Reimplement this method to add application specific translations to your application. The default method returns a list with the default Qt and the default Camelot translator for the current system locale. Call `QLocale.setDefault()` before this method is called if you want to load different translations then the system default.

    Returns: | a list of `QtCore.QTranslator` objects that should be used to translate the application

  `get_version`()

    Returns: | string representing version of the application, by default this

    is the class attribute verion

  `get_versions`()

    Returns: | html which displays the versions of used libs for development

  `get_whats_new`()

    Returns: | a widget that has a show() method

  `help_url` = 'http://www.python-camelot.com/docs.html'
  `name` = 'Camelot'
  `read_null`()

    Create a segmentation fault by reading null, this is to test the faulthandling functions. this method is triggered by pressing `Ctrl-Alt-0` in the GUI

  `register`(entity, admin_class)

    Associate a certain ObjectAdmin class with another class. This ObjectAdmin will be used as default to render object the specified type.

    Parameters: | entity – `class` admin_class – a subclass of `camelot.admin.object_admin.ObjectAdmin` or `camelot.admin.entity_admin.EntityAdmin`

  `restore`(main_window)
  `sections_changed_signal`
  `show_versions`()

    Pops up a messagebox showing the version of certain libraries used. This is for debugging purposes.

  `title_changed_signal`
  `version` = '1.0'

`camelot.admin.application_admin.``get_application_admin`()

## `entity_admin` Module

class `camelot.admin.entity_admin.``EntityAdmin`(app_admin, entity)

  Bases: `camelot.admin.object_admin.ObjectAdmin`

  Admin class specific for classes that are mapped by sqlalchemy. This allows for much more introspection than the standard `camelot.admin.object_admin.ObjectAdmin`.

  It has additional class attributes that customise its behaviour.

  Basic

  `list_action`

    The `camelot.admin.action.Action` that will be triggered when the user selects an item in a list of objects. This defaults to `camelot.admin.action.list_action.OpenFormView`, which opens a form for the current object.

  Filtering

  `list_filter`

    A list of fields that should be used to generate filters for in the table view. If the field named is a one2many, many2one or many2many field, the field name should be followed by a field name of the related entity

        class Project(Entity):
            oranization = OneToMany('Organization')
            name = Field(Unicode(50))

          class Admin(EntityAdmin):
              list_display = ['organization']
              list_filter = ['organization.name']

  Copying

  `copy_deep`

    A dictionary of fields that will be deep copied when the user presses the copy button. This is usefull for OneToMany fields. The key in the dictionary should be the name of the field, and the value is a new dictionary that can contain other fields that need to be copied:

        copy_deep = {'addresses':{}}

  `copy_exclude`

    A list of fields that should not be copied when the user presses the copy button:

        copy_exclude = ['name']

    The fields that form the primary key of the object will be excluded by default.

  Searching

  `list_search`

    A list of fields that should be searched when the user enters something in the search box in the table view. By default all fields are searched for which Camelot can do a conversion of the entered string to the datatype of the underlying column.

    For use with one2many, many2one or many2many fields, the same rules as for the list_filter attribute apply

  `search_all_fields`

    Defaults to True, meaning that by default all searchable fields should be searched. If this is set to False, one should explicitely set the list_search attribute to enable search.

  `expanded_list_search`

    A list of fields that will be searchable through the expanded search. When set to None, all the fields in list_display will be searchable. Use this attribute to limit the number of search widgets. Defaults to None.

  `copy`(*args, **kwargs)

    Duplicate an object. If no new object is given to copy to, a new one will be created. This function will be called every time the user presses a copy button.

    Parameters: | obj – the object to be copied from new_obj – the object to be copied to, defaults to None
    Returns: | the new object

    This function takes into account the deep_copy and the copy_exclude attributes. It tries to recreate relations with a minimum of side effects.

  `copy_deep` = {}
  `copy_exclude` = []
  `create_select_view`(*args, **kwargs)

    Returns a Qt widget that can be used to select an element from a query

    Parameters: | query – sqlalchemy query object parent – the widget that will contain this select view, the

    returned widget has an entity_selected_signal signal that will be fired when a entity has been selected.

  `create_table_view`(*args, **kwargs)

    Returns a QWidget containing a table view

  `delete`(*args, **kwargs)

    Delete an entity instance

  `expanded_list_search` = None
  `expunge`(*args, **kwargs)

    Expunge the entity from the session

  `flush`(*args, **kwargs)

    Flush the pending changes of this entity instance to the backend

  `get_dynamic_field_attributes`(obj, field_names)

    Takes the dynamic field attributes from through the ObjectAdmin its get_dynamic_field_attributes and add the new_message attributes for One2Many fields where the object was not flushed yet

  `get_expanded_search_fields`(*args, **kwargs)

    Returns: | a list of tuples of type [(field_name, field_attributes)]

  `get_field_attributes`(*args, **kwargs)

    Get the attributes needed to visualize the field field_name :param field_name: the name of the field

    Returns: | a dictionary of attributes needed to visualize the field,

    those attributes can be:
      - python_type : the corresponding python type of the object
      - editable : bool specifying wether the user can edit this field
      - widget : which widget to be used to render the field
      - ...
  `get_filters`(*args, **kwargs)

    Returns the filters applicable for these entities each filter is

    Returns: | [(filter_name, [(option_name, query_decorator), ...), ... ]

  `get_list_charts`(*args, **kwargs)
  `get_query`(*args, **kwargs)

    Returns: | an sqlalchemy query for all the objects that should be

    displayed in the table or the selection view. Overwrite this method to change the default query, which selects all rows in the database.

  `get_verbose_identifier`(*args, **kwargs)
  `is_deleted`(*args, **kwargs)

    Returns: | True if the object has been deleted from the persistent

    state, False otherwise

  `is_persistent`(*args, **kwargs)

    Returns: | True if the object has a persisted state, False otherwise

  `list_action` = <camelot.admin.action.list_action.OpenFormView object at 0xa10cf2c>
  `list_search` = []
  `refresh`(*args, **kwargs)

    Undo the pending changes to the backend and restore the original state

  `search_all_fields` = True
  `set_defaults`(*args, **kwargs)

    Set the fields of an object to their default state.

    Parameters: | include_nullable_fields – also set defaults for nullable fields, depending on the context, this should be set to False to allow the user to set the field to None

  `validator`

    alias of `EntityValidator`

## `not_editable_admin` Module

Class decorator to make all fields visualized with the Admin into read-only fields

`camelot.admin.not_editable_admin.``notEditableAdmin`(original_admin, actions=False, editable_fields=None)

  Turn all fields visualized with original_admin into read only fields :param original_admin: an implementation of ObjectAdmin :param actions: True if the notEditableAdmin should have its actions enabled, default to False :param editable_fields: list of fields that should remain editable

  usage

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

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

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

## `object_admin` Module

Admin class for Plain Old Python Object

class `camelot.admin.object_admin.``FieldAttributesList`(original_list)

  Bases: `list`

  A list with field attributes that documents them for sphinx

class `camelot.admin.object_admin.``ObjectAdmin`(app_admin, entity)

  Bases: `object`

  The ObjectAdmin class describes the interface that will be used to interact with objects of a certain class. The behaviour of this class and the resulting interface can be tuned by specifying specific class attributes:

  The name used in the GUI

  The name used in the GUI for things like window titles and such can be specified using the verbose_name attribute.

  `verbose_name`

    A human-readable name for the object, singular

        verbose_name = _('movie')

    If this isn’t given, the class name will be used

  `verbose_name_plural`

    A human-readable name for the object, plural

        verbose_name_plural = _('movies')

    If this isn’t given, Camelot will use verbose_name + “s”

  Fields displayed

  `list_display`

    a list with the fields that should be displayed in a table view

  `list_columns_frozen`

    the number of columns on the left of the tableview that should be frozen (don’t dissapear when the user uses the horizontal scroll bar), defaults to zero

  `lines_per_row`

    An integer number specifying the height of a row in the table view, expressed as the number of lines of text it should be able to display. Defaults to 1.

  `form_display`

    a list with the fields that should be displayed in a form view, defaults to the same fields as those specified in list_display

        class Admin(EntityAdmin):
            form_display = ['title', 'rating', 'cover']

    instead of telling which fields to display. It is also possible to define the form itself

        from camelot.view.forms import Form, TabForm, WidgetOnlyForm, HBoxForm

        class Admin(EntityAdmin):
            form_display = TabForm([
            ('Movie', Form([
              HBoxForm([['title', 'rating'], WidgetOnlyForm('cover')]),
              'short_description',
              'releasedate',
              'director',
              'script',
              'genre',
              'description', 'tags'], scrollbars=True)),
            ('Cast', WidgetOnlyForm('cast'))
          ])

  Behaviour

  `save_mode`

    Specifies when the data should be send from the view to the model and flushed to the database. The default mode is ‘on_change’, meaning that every change in the view will be send immediately to the database. Other possibilities are :

    > - ‘on_leave’ : the data will be send from the view to the model when the view

    >     is closed, eg. : the form is closed.

  `delete_mode`

    Indicates if the deletion of an object should be confirmed by the user, defaults to ‘on_request’, indicating object should be deleted when the user hits the trash button. Other possibilities are :

    > - ‘on_confirm’ : the user will be asked for confirmation before the delete takes place.

  `form_size`

    a tuple indicating the size of a form view, defaults to (700,500)

  `form_actions`

    Actions to be accessible by pushbuttons on the side of a form, a list of tuples (button_label, action_function) where action_function takes as its single argument, a method that returns the the object that was displayed by the form when the button was pressed:

        class Admin(EntityAdmin):
            form_actions = [('Foo', lamda o_getter:print 'foo')]

  Field attributes

  `field_attributes`

    A dictionary specifying for each field of the model some additional attributes on how they should be displayed. All of these attributes are propagated to the constructor of the delegate of this field:

        class Movie(Entity):
            title = Field(Unicode(50))

            class Admin(EntityAdmin):
                list_display = ['title']
                field_attributes = dict(title=dict(editable=False))

    The Field Attributes documentation describes the various keys that can be used in the field attributes class attribute of an ObjectAdmin or EntityAdmin.

  Window state

  `form_state`

    Set this attribute to ‘maximized’ or ‘minimized’ for respective behaviour. These are the only two defined at the moment. Please use the constants defined in camelot.core.constants (MINIMIZE and MAXIMIZE). Note that this attr needs to be set at the form, highest in the form hierarchy to work. Setting this on embedded forms will not influence the window state. Example:

        class Movie(Entity):
            title = Field(Unicode(50))

            class Admin(EntityAdmin):
                from camelot.core import constants
                list_display = ['title']
                form_state = constants.MAXIMIZED
                field_attributes = dict(title=dict(editable=False))

  Varia

  `model`

    The QAbstractItemModel class to be used to display collections of this object, defaults to a CollectionProxy

  `TableView`

    The QWidget class to be used when a table view is needed

  class `TableView`(admin, search_text=None, parent=None)

    Bases: `camelot.view.controls.view.AbstractView`

    A generic tableview widget that puts together some other widgets. The behaviour of this class and the resulting interface can be tuned by specifying specific class attributes which define the underlying widgets used

        class MovieRentalTableView(TableView):
          title_format = 'Grand overview of recent movie rentals'

    The attributes that can be specified are :

    `header_widget`

    The widget class to be used as a header in the table view:

        header_widget = HeaderWidget

    `table_widget`

    The widget class used to display a table within the table view

    table_widget = TableWidget

    `title_format`

    A string used to format the title of the view

    title_format = ‘%(verbose_name_plural)s’

    `table_model`

    A class implementing QAbstractTableModel that will be used as a model for the table view

        table_model = QueryTableProxy

    - emits the row_selected signal when a row has been selected
    class `AdminTableWidget`(admin, parent=None)

      Bases: `camelot.view.controls.tableview.TableWidget`

      A table widget that inspects the admin class and changes the behavior of the table as specified in the admin class

      `copy_selected_rows`()
      `delete_selected_rows`()
    `ObjectAdmin.TableView.``activate_search`()
    `ObjectAdmin.TableView.``cancelSearch`()

      resets search filtering to default

    `ObjectAdmin.TableView.``closeEvent`(event)

      reimplements close event

    `ObjectAdmin.TableView.``copy_selected_rows`()

      Copy the selected rows in this tableview

    `ObjectAdmin.TableView.``create_table_model`(admin)

      Create a table model for the given admin interface

    `ObjectAdmin.TableView.``deleteSelectedRows`()

      delete the selected rows in this tableview

    `ObjectAdmin.TableView.``focusTable`()
    `ObjectAdmin.TableView.``getColumns`()

      return the columns to be displayed in the table view

    `ObjectAdmin.TableView.``getData`()

      generator for data queried by table model

    `ObjectAdmin.TableView.``getTitle`()

      return the name of the entity managed by the admin attribute

    `ObjectAdmin.TableView.``get_admin`()
    `ObjectAdmin.TableView.``get_collection_getter`(*args, **kwargs)

      Returns: | a list with all the objects corresponding to the rows in the table

    `ObjectAdmin.TableView.``get_model`()
    `ObjectAdmin.TableView.``get_selection_getter`(*args, **kwargs)

      Returns: | a function that when called return an iterable with all the

      objects corresponding to the selected rows in the table.

    `ObjectAdmin.TableView.``get_title`(*args, **kwargs)
    `ObjectAdmin.TableView.``header_widget`

      alias of `HeaderWidget`

    `ObjectAdmin.TableView.``importFromFile`()

      “import data : the data will be imported in the activeMdiChild

    `ObjectAdmin.TableView.``makeImport`()
    `ObjectAdmin.TableView.``newRow`(*args, **kwargs)

      Create a new row in the tableview

    `ObjectAdmin.TableView.``on_keyboard_selection_signal`()
    `ObjectAdmin.TableView.``rebuild_query`()

      resets the table model query

    `ObjectAdmin.TableView.``refresh`()

      Refresh the whole view

    `ObjectAdmin.TableView.``row_selected_signal`
    `ObjectAdmin.TableView.``sectionClicked`(section)

      emits a row_selected signal

    `ObjectAdmin.TableView.``selectTableRow`(row)

      selects the specified row

    `ObjectAdmin.TableView.``select_all_rows`()
    `ObjectAdmin.TableView.``selectedTableIndexes`(*args, **kwargs)

      returns a list of selected rows indexes

    `ObjectAdmin.TableView.``setSubclassTree`(*args, **kwargs)
    `ObjectAdmin.TableView.``set_admin`(*args, **kwargs)

      Switch to a different subclass, where admin is the admin object of the subclass

    `ObjectAdmin.TableView.``set_filters_and_actions`(*args, **kwargs)

      sets filters for the tableview

    `ObjectAdmin.TableView.``startSearch`(text)

      rebuilds query based on filtering text

    `ObjectAdmin.TableView.``tableLayoutChanged`(*args, **kwargs)
    `ObjectAdmin.TableView.``table_model`

      alias of `QueryTableProxy`

    `ObjectAdmin.TableView.``title_format` = '%(verbose_name_plural)s'
    `ObjectAdmin.TableView.``to_html`()

      generates html of the table

    `ObjectAdmin.TableView.``viewFirst`()

      selects first row

    `ObjectAdmin.TableView.``viewLast`()

      selects last row

    `ObjectAdmin.TableView.``viewNext`()

      selects next row

    `ObjectAdmin.TableView.``viewPrevious`()

      selects previous row

  `ObjectAdmin.``add`(*args, **kwargs)

    Add an entity instance as a managed entity instance

  `ObjectAdmin.``copy`(*args, **kwargs)

    Duplicate this entity instance

  `ObjectAdmin.``create_form_view`(*args, **kwargs)

    Creates a Qt widget containing a form view, for a specific index in a model. Use this method to create a form view for a collection of objects, the user will be able to use `PgUp`/`PgDown` to move to the next object.

    Parameters: | title – the title of the form view model – the data model to be used to fill the form view index – which row in the data model to display parent – the parent widget for the form

  `ObjectAdmin.``create_new_view`(*args, **kwargs)

    Create a Qt widget containing a form to create a new instance of the entity related to this admin class

    The returned class has an ‘entity_created_signal’ that will be fired when a valid new entity was created by the form

    Parameters: | collection_proxy – if specified, the object will be appended to

    its underlying collection upon creation and removed from it upon discarding.

  `ObjectAdmin.``create_object_form_view`(*args, **kwargs)

    Create a form view for a single object, `PgUp`/`PgDown` will do nothing.

    Parameters: | title – the title of the form view object_getter – a function taking no arguments, and returning the object parent – the parent widget for the form

  `ObjectAdmin.``create_validator`(model)
  `ObjectAdmin.``delete`(*args, **kwargs)

    Delete an entity instance

  `ObjectAdmin.``delete_mode` = 'on_request'
  `ObjectAdmin.``expunge`(*args, **kwargs)

    Remove this object from the objects being managed

  `ObjectAdmin.``field_attributes` = {}
  `ObjectAdmin.``fields` = []
  `ObjectAdmin.``flush`(*args, **kwargs)

    Flush the pending changes of this entity instance to the backend

  `ObjectAdmin.``form_actions` = []
  `ObjectAdmin.``form_display` = []
  `ObjectAdmin.``form_size` = (700, 500)
  `ObjectAdmin.``form_state` = None
  `ObjectAdmin.``get_all_fields_and_attributes`(*args, **kwargs)

    A dictionary of (field_name:field_attributes) for all fields that can possibly appear in a list or a form or for which field attributes have been defined

  `ObjectAdmin.``get_columns`(*args, **kwargs)

    The columns to be displayed in the list view, returns a list of pairs of the name of the field and its attributes needed to display it properly

    @return: [(field_name,

      > {‘widget’: widget_type,
      >   ‘editable’: True or False, ‘blank’: True or False, ‘validator_list’:[...], ‘name’:’Field name’}),

      ...]

  `ObjectAdmin.``get_delete_message`(obj)
  `ObjectAdmin.``get_delete_mode`()
  `ObjectAdmin.``get_depending_objects`(*args, **kwargs)

    Overwrite this function to generate a list of objects that depend on a given object. When obj is modified by the user, this function will be called to determine which other objects need their views updated.

    Parameters: | obj – an object of the type that is managed by this admin class
    Returns: | an iterator over objects that depend on obj

  `ObjectAdmin.``get_dynamic_field_attributes`(obj, field_names)

    Convenience function to get all the field attributes that are dynamic (depend on the object being visualized). This method is called once for each object/row in a table view and once for each object being visualized in a form view.

    Parameters: | field_names – a list of field names obj – the object at the row for which to get the values of the dynamic field attributes
    Returns: | [{field_attribute_name:field_attribute_value, ...}, {}, ...]

    The returned list has the same order than the requested field_names.

  `ObjectAdmin.``get_entity_admin`(entity)
  `ObjectAdmin.``get_field_attributes`(field_name)

    Get the attributes needed to visualize the field field_name. This function is called by get_static_field_attributes and get_dynamic_field_attributes.

    This function first tries to fill the dictionary with field attributes for a field with those gathered through introspection, and then updates them with those found in the field_attributes class attribute.

    Parameters: | field_name – the name of the field
    Returns: | a dictionary of attributes needed to visualize the field

    The values of the returned dictionary either contain the value of the field attribute, or in the case of dynamic field attributes, a function that returns the value of the field attribute.

  `ObjectAdmin.``get_fields`(*args, **kwargs)
  `ObjectAdmin.``get_form_actions`(*args, **kwargs)

    Returns: | a list of FormAction objects

  `ObjectAdmin.``get_form_display`(*args, **kwargs)
  `ObjectAdmin.``get_icon`()
  `ObjectAdmin.``get_list_actions`(*args, **kwargs)
  `ObjectAdmin.``get_name`()
  `ObjectAdmin.``get_related_admin`(cls)

    Get an admin object for another object class. Taking into account preferences of this admin object or for those of admin object higher up the chain such as the application admin object.

    Parameters: | cls – the class for which an admin object is requested

  `ObjectAdmin.``get_related_entity_admin`(entity)

    deprecated : use get_related_admin

  `ObjectAdmin.``get_save_mode`()
  `ObjectAdmin.``get_static_field_attributes`(field_names)

    Convenience function to get all the field attributes that are static (don’t depend on the object being visualized). This method is only called once for a table or form view, independent of the number of objects/records being visualized.

    Parameters: | field_names – a list of field names
    Returns: | [{field_attribute_name:field_attribute_value, ...}, {}, ...]

    The returned list has the same order than the requested field_names.

  `ObjectAdmin.``get_subclass_tree`(*args, **kwargs)

    Get a tree of admin classes representing the subclasses of the class represented by this admin class

    Returns: | [(subclass_admin, [(subsubclass_admin, [...]),...]),...]

  `ObjectAdmin.``get_verbose_identifier`(*args, **kwargs)

    Create an identifier for an object that is interpretable for the user, eg : the primary key of an object. This verbose identifier can be used to generate a title for a form view of an object.

  `ObjectAdmin.``get_verbose_name`()
  `ObjectAdmin.``get_verbose_name_plural`()
  `ObjectAdmin.``icon` = None
  `ObjectAdmin.``is_deleted`(*args, **kwargs)

    Returns: | True if the object has been deleted from the persistent

    state, False otherwise

  `ObjectAdmin.``is_persistent`(*args, **kwargs)

    Returns: | True if the object has a persisted state, False otherwise

  `ObjectAdmin.``lines_per_row` = 1
  `ObjectAdmin.``list_actions` = []
  `ObjectAdmin.``list_charts` = []
  `ObjectAdmin.``list_columns_frozen` = 0
  `ObjectAdmin.``list_display` = []
  `ObjectAdmin.``list_filter` = []
  `ObjectAdmin.``list_size` = (600, 400)
  `ObjectAdmin.``model`

    alias of `CollectionProxy`

  `ObjectAdmin.``refresh`(*args, **kwargs)

    Undo the pending changes to the backend and restore the original state

  `ObjectAdmin.``save_mode` = 'on_edit'
  `ObjectAdmin.``set_defaults`(object_instance, include_nullable_fields=True)

    Set the defaults of an object :param include_nullable_fields: also set defaults for nullable fields, depending on the context, this should be set to False to allow the user to set the field to None

  `ObjectAdmin.``validator`

    alias of `ObjectValidator`

  `ObjectAdmin.``verbose_name` = None
  `ObjectAdmin.``verbose_name_plural` = None

## `section` Module

class `camelot.admin.section.``Section`(verbose_name, application_admin, icon=None, items=[])

  Bases: `object`

  A Section as displayed in the left pane of the application. Each Section contains a list of SectionItems the user can click on. Sections should be used in the definition of the Application admin:

                      Section( _('Movies'),
                               self,
                               Icon('tango/22x22/mimetypes/x-office-presentation.png'),
                               items = [ Movie,
                                         Tag,
                                         VisitorReport,
                                         VisitorsPerDirector,
                                         ImportCovers() ]),

  `get_icon`()
  `get_items`(*args, **kwargs)
  `get_verbose_name`()

class `camelot.admin.section.``SectionItem`(action, application_admin, verbose_name=None)

  Bases: `object`

  An item inside a section, the user can click on and trigger an action.

  `get_action`()
  `get_icon`()
  `get_modes`()
  `get_tooltip`()
  `get_verbose_name`()

`camelot.admin.section.``structure_to_section_items`(structure, application_admin)

## Subpackages

- action Package
  - `action` Package
  - `application_action` Module
  - `base` Module
  - `form_action` Module
  - `list_action` Module
- validator Package
  - `validator` Package
  - `entity_validator` Module
  - `object_validator` Module

### Navigation

- index
- modules |
- Camelot documentation »

Comments
blog comments powered by Disqus