Package Camelot :: Package camelot :: Package view :: Module elixir_admin :: Class EntityAdmin
[frames] | no frames]

Class EntityAdmin

source code


Admin class specific for classes that are mapped by sqlalchemy. This allows for much more introspection than the standard ObjectAdmin.
Nested Classes
  validator
A validator class validates an entity before flushing it to the database and provides the user with feedback if the entity is not ready to flush

Inherited from camelot.admin.object_admin.ObjectAdmin: model

Instance Methods
 
get_query(*args, **kwargs)
displayed in the table or the selection view. Overwrite this method to change the default query, which selects all rows in the database.
source code
 
get_subclass_entity_admin(*args, **kwargs)
Get the admin class for an entity that is a subclass of this admin's entity or this admin's entity itself.
source code
 
get_subclasses(*args, **kwargs)
Returns admin objects for the subclasses of the Entity represented by this admin object.
source code
 
get_verbose_identifier(*args, **kwargs)
Create an identifier for an object that is interpretable for the user, eg : the 'id' of an object. This verbose identifier can be used to generate a title for a form view of an object.
source code
 
get_field_attributes(*args, **kwargs)
Get the attributes needed to visualize the field field_name :param field_name: the name of the field
source code
 
get_list_charts(*args, **kwargs) source code
 
get_filters(*args, **kwargs)
Returns the filters applicable for these entities each filter is
source code
 
set_defaults(*args, **kwargs)
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
source code
 
create_select_view(*args, **kwargs)
Returns a Qt widget that can be used to select an element from a query
source code
 
create_table_view(*args, **kwargs)
Returns a Qt widget containing a table view, for a certain query, using this Admin class; the table widget contains a model QueryTableModel
source code
 
delete(*args, **kwargs)
Delete an entity instance
source code
 
flush(*args, **kwargs)
Flush the pending changes of this entity instance to the backend
source code
 
copy(*args, **kwargs)
Duplicate this entity instance
source code

Inherited from camelot.admin.object_admin.ObjectAdmin: __init__, __repr__, __str__, add, create_form_view, create_new_view, create_object_form_view, create_validator, get_all_fields_and_attributes, get_columns, get_confirm_delete, get_entity_admin, get_fields, get_form_actions, get_form_display, get_list_actions, get_name, get_related_entity_admin, get_subclass_tree, get_verbose_name, get_verbose_name_plural

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables

Inherited from camelot.admin.object_admin.ObjectAdmin: TableView, confirm_delete, field_attributes, fields, form, form_actions, form_display, form_size, form_title_column, list_actions, list_charts, list_display, list_filter, list_search, list_size, name, verbose_name, verbose_name_plural

Properties

Inherited from object: __class__

Method Details

get_query(*args, **kwargs)

source code 
displayed in the table or the selection view. Overwrite this method to change the default query, which selects all rows in the database.
Returns:
an sqlalchemy query for all the objects that should be
Decorators:
  • @model_function

get_subclass_entity_admin(*args, **kwargs)

source code 
Get the admin class for an entity that is a subclass of this admin's entity or this admin's entity itself.
Decorators:
  • @model_function

get_subclasses(*args, **kwargs)

source code 
Returns admin objects for the subclasses of the Entity represented by this admin object.
Decorators:
  • @model_function

get_verbose_identifier(*args, **kwargs)

source code 
Create an identifier for an object that is interpretable for the user, eg : the 'id' of an object. This verbose identifier can be used to generate a title for a form view of an object.
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.get_verbose_identifier
(inherited documentation)

get_field_attributes(*args, **kwargs)

source code 

Get the attributes needed to visualize the field field_name :param field_name: the name of 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
  • ...
Returns:
a dictionary of attributes needed to visualize the field,
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.get_field_attributes

get_list_charts(*args, **kwargs)

source code 
Decorators:
  • @model_function

get_filters(*args, **kwargs)

source code 
Returns the filters applicable for these entities each filter is
Returns:
[(filter_name, [(option_name, query_decorator), ...), ... ]
Decorators:
  • @model_function

set_defaults(*args, **kwargs)

source code 
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
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.set_defaults

create_select_view(*args, **kwargs)

source code 

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

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

Parameters:
  • query - sqlalchemy query object
  • parent - the widget that will contain this select view, the
Decorators:
  • @gui_function

create_table_view(*args, **kwargs)

source code 
Returns a Qt widget containing a table view, for a certain query, using this Admin class; the table widget contains a model QueryTableModel
Parameters:
  • query_getter - sqlalchemy query object
  • parent - the workspace widget that will contain the table view
Decorators:
  • @gui_function

delete(*args, **kwargs)

source code 
Delete an entity instance
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.delete

flush(*args, **kwargs)

source code 
Flush the pending changes of this entity instance to the backend
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.flush

copy(*args, **kwargs)

source code 
Duplicate this entity instance
Decorators:
  • @model_function
Overrides: camelot.admin.object_admin.ObjectAdmin.copy