The administrator simplified API. This API is a simplified wrapper of devilry.apps.core.models — Devilry core datastructure for administrators. Every action requires the given user to be administrator on the object being manipulated.
Bases: devilry.apps.administrator.simplified.hasadminsmixin.HasAdminsMixin, devilry.apps.administrator.simplified.cansavebase.CanSaveBase
Simplified wrapper for devilry.apps.core.models.Node.
Bases: devilry.apps.administrator.simplified.hasadminsmixin.MetaMixin
Defines the CRUD+S methods, the django model to be used, resultfields returned by search and which fields can be used to search for a Node object using the Simplified API
alias of Node
Returns all node-objects where given user is admin or superadmin.
Parameters: | user – A django user object. |
---|---|
Return type: | a django queryset |
Return True if the given node contains no childnodes or subjects.
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user can save changes to obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Bases: devilry.apps.administrator.simplified.hasadminsmixin.HasAdminsMixin, devilry.apps.administrator.simplified.cansavebase.CanSaveBase
Simplified wrapper for devilry.apps.core.models.Subject.
Bases: devilry.apps.administrator.simplified.hasadminsmixin.MetaMixin, devilry.coreutils.simplified.metabases.subject.SimplifiedSubjectMetaMixin
Defines what methods an Administrator can use on a Subject object using the Simplified API
alias of Subject
Return True if the given subject contains no periods
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Returns all objects of this type that matches arguments given in \*\*kwargs where user is admin or superadmin.
Parameters: |
|
---|---|
Return type: | a django queryset |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user can save changes to obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Bases: devilry.apps.administrator.simplified.hasadminsmixin.HasAdminsMixin, devilry.apps.administrator.simplified.cansavebase.CanSaveBase
Simplified wrapper for devilry.apps.core.models.Period.
Bases: devilry.apps.administrator.simplified.hasadminsmixin.MetaMixin, devilry.coreutils.simplified.metabases.period.SimplifiedPeriodMetaMixin
Defines what methods an Administrator can use on a Period object using the Simplified API
alias of Period
Return True if the given period contains no assignments
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Returns all objects of this type that matches arguments given in \*\*kwargs where user is admin or superadmin.
Parameters: |
|
---|---|
Return type: | a django queryset |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user can save changes to obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Bases: devilry.apps.administrator.simplified.hasadminsmixin.HasAdminsMixin, devilry.apps.administrator.simplified.cansavebase.CanSaveBase
Simplified wrapper for devilry.apps.core.models.Assignment.
Bases: devilry.apps.administrator.simplified.hasadminsmixin.MetaMixin, devilry.coreutils.simplified.metabases.assignment.SimplifiedAssignmentMetaMixin
Defines what methods an Administrator can use on an Assignment object using the Simplified API
alias of Assignment
Return True if the given assignment contains no assignmentgroups.
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Returns all objects of this type that matches arguments given in \*\*kwargs where user is admin or superadmin.
Parameters: |
|
---|---|
Return type: | a django queryset |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user can save changes to obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Bases: devilry.apps.administrator.simplified.cansavebase.CanSaveBase
Simplified wrapper for devilry.apps.core.models.AssignmentGroup.
Bases: devilry.coreutils.simplified.metabases.assignment_group.SimplifiedAssignmentGroupMetaMixin
Defines what methods an Administrator can use on an AssignmentGroup object using the Simplified API
alias of AssignmentGroup
Returns all Deadline-objects where given user is admin or superadmin.
Parameters: | user – A django user object. |
---|---|
Return type: | a django queryset |
Return True if the given assignmentgroup contains no deliveries.
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user can save changes to obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Bases: devilry.simplified.modelapi.SimplifiedModelApi
Simplified wrapper for devilry.apps.core.models.Deadline.
Bases: devilry.coreutils.simplified.metabases.deadline.SimplifiedDeadlineMetaMixin
Defines what methods an Administrator can use on a Deadline object using the Simplified API
alias of Deadline
Returns all Deadline-objects where given user is admin or superadmin.
Parameters: | user – A django user object. |
---|---|
Return type: | a django queryset |
Checks if the given user is an administrator for the given Deadline obj or a superadmin, and raises PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Checks if the given user can save changes to the AssignmentGroup of the given Deadline obj, and raises PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Check if the given obj is empty. Defaults to returning False.
Can be implemented in subclasses to enable superadmins to recursively delete() the obj.
Invoked after the obj has been saved.
Override this to set custom/generated values on obj after it has been validated and saved. The default does nothing.
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Bases: devilry.simplified.modelapi.SimplifiedModelApi
Simplified wrapper for devilry.apps.core.models.Delivery.
Bases: devilry.coreutils.simplified.metabases.delivery.SimplifiedDeliveryMetaMixin
Defines what methods an Administrator can use on a Delivery object using the Simplified API
alias of Delivery
Returns all objects of this type that matches arguments given in \*\*kwargs where user is admin or superadmin.
Parameters: |
|
---|---|
Return type: | a django queryset |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Create the given object.
Parameters: | user – Django user object. |
---|---|
Field_values : | The values to set on the given object. |
Returns: | The primary key of the newly created object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Check if the given obj is empty. Defaults to returning False.
Can be implemented in subclasses to enable superadmins to recursively delete() the obj.
Invoked after the obj has been saved.
Override this to set custom/generated values on obj after it has been validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update the given object.
Parameters: |
|
---|---|
Param : | field_values: The values to set on the given object. |
Returns: | The primary key of the updated object. |
Throws PermissionDenied: | |
If the given user does not have permission to edit this object, if the object does not exist, or if any of the field_values is not in cls._meta.editablefields. |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Bases: devilry.simplified.modelapi.SimplifiedModelApi
Simplified wrapper for devilry.apps.core.models.Delivery.
Bases: devilry.coreutils.simplified.metabases.staticfeedback.SimplifiedStaticFeedbackMetaMixin
Defines what methods an Administrator can use on a StaticFeedback object using the Simplified API
alias of StaticFeedback
Returns all StaticFeedback-objects where given user is admin or superadmin.
Parameters: | user – A django user object. |
---|---|
Return type: | a django queryset |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Check if the given obj is empty. Defaults to returning False.
Can be implemented in subclasses to enable superadmins to recursively delete() the obj.
Invoked after the obj has been saved.
Override this to set custom/generated values on obj after it has been validated and saved. The default does nothing.
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user has read permission on the given obj.
Defaults to cls.write_authorize(user, obj)
Raises PermissionDenied: | |
---|---|
If the given user do not have read permission on the given obj. |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |
Bases: devilry.simplified.modelapi.SimplifiedModelApi
Simplified wrapper for devilry.apps.core.models.FileMeta.
Bases: devilry.coreutils.simplified.metabases.filemeta.SimplifiedFileMetaMetaMixin
Defines what methods an Administrator can use on a FileMeta object using the Simplified API
alias of FileMeta
Returns all FileMeta-objects where given user is admin or superadmin.
Parameters: | user – A django user object. |
---|---|
Return type: | a django queryset |
Check if the given user can save changes to the given obj, and raise PermissionDenied if not.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
Create many.
This does the same as calling create() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see create()). |
---|---|
Returns: | List of the primary keys of the created objects. |
Delete the given object. If the object is_empty() it can be deleted by any user with write_authorize(), if not then only a Superuser may delete the object
Parameters: |
|
---|---|
Returns: | The primary key of the deleted object. |
Throws PermissionDenied: | |
If the given user does not have permission to delete this object, if the object does not exist, or if the user does not have permission to recursively delete this objects and all its children. |
Delete many.
This does the same as calling delete() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_pks List of primary-keys/ids of the objects to delete. |
---|---|
Returns: | List of the primary keys of the deleted objects. |
Can be overridden to change fieldgroups before they are sent into the QryResultWrapper. For example, if certain fieldgroups contain senstive data for anonymous assignments, we can add those fieldgroups if a filter for a specific assignment is provided in filters and that assignment is not anonymous.
Returns: | (result_fieldgroups, search_fieldgroups) |
---|
Check if the given obj is empty. Defaults to returning False.
Can be implemented in subclasses to enable superadmins to recursively delete() the obj.
Invoked after the obj has been saved.
Override this to set custom/generated values on obj after it has been validated and saved. The default does nothing.
Invoked after the user has been authorize by write_authorize() and before obj.full_clean() in create() and update().
Override this to set custom/generated values on obj before it is validated and saved. The default does nothing.
Read the requested item and return a dict with the fields specified in Meta.resultfields and additional fields specified in result_fieldgroups.
Parameters: |
|
---|---|
Throws PermissionDenied: | |
If the given user does not have permission to view this object, or if the object does not exist. |
Check if the given user has read permission on the given obj.
Defaults to cls.write_authorize(user, obj)
Raises PermissionDenied: | |
---|---|
If the given user do not have read permission on the given obj. |
Search for objects.
Parameters: |
|
---|---|
Returns: | The result of the search. |
Return type: | QryResultWrapper |
Update many.
This does the same as calling update() many times, except that it does it all in a single transaction. This means that the database rolls back the changes unless they all succeed.
Param : | list_of_field_values List of field_values dicts (see update()). Each dict _must_ have a _pk_ key that maps to the primary-key/id value. |
---|---|
Returns: | List of the primary keys of the updated objects. |