Allocations
Allocation (TimeStampedModel)
django-model
An allocation provides users access to a resource.
Attributes:
Name | Type | Description |
---|---|---|
project |
Project |
links the project the allocation falls under |
resources |
Resource |
links resources that this allocation allocates |
status |
AllocationStatusChoice |
represents the status of the allocation |
quantity |
int |
indicates the quantity of the resource for the allocation, if applicable |
start_date |
Date |
indicates the start date of the allocation |
end_date |
Date |
indicates the end/ expiry date of the allocation |
justification |
str |
text input from the user containing the justification for why the resource is being allocated |
description |
str |
description of the allocation |
is_locked |
bool |
indicates whether or not the allocation is locked |
is_changeable |
bool |
indicates whether or not the allocation is changeable |
created: AutoCreatedField
django-field
created
description: CharField
blank
django-field
nullable
description
end_date: DateField
blank
django-field
nullable
end date
expires_in
property
readonly
Returns:
Type | Description |
---|---|
int |
the number of days until the allocation expires |
get_information
property
readonly
Returns:
Type | Description |
---|---|
str |
the allocation's attribute type, usage out of total value, and usage out of total value as a percentage |
get_parent_resource
property
readonly
Returns:
Type | Description |
---|---|
Resource |
the parent resource for the allocation |
get_resources_as_list
property
readonly
Returns:
Type | Description |
---|---|
list[Resource] |
the resources for the allocation |
get_resources_as_string
property
readonly
Returns:
Type | Description |
---|---|
str |
the resources for the allocation |
is_changeable: BooleanField
django-field
is changeable
is_locked: BooleanField
django-field
is locked
justification: TextField
django-field
justification
modified: AutoLastModifiedField
django-field
modified
project: ForeignKey
django-field
project
quantity: IntegerField
django-field
quantity
resources: ManyToManyField
django-field
resources
start_date: DateField
blank
django-field
nullable
start date
status: ForeignKey
django-field
Status
clean
Validates the allocation and raises errors if the allocation is invalid.
get_attribute
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the allocation attribute type |
required |
expand |
bool |
indicates whether or not to return the expanded value with attributes/parameters for attributes with a base type of 'Attribute Expanded Text' |
True |
typed |
bool |
indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name |
True |
extra_allocations |
list[Allocation] |
allocations which are available to reference in the attribute list in addition to those associated with this AllocationAttribute |
[] |
Returns:
Type | Description |
---|---|
str |
the value of the first attribute found for this allocation with the specified name |
get_attribute_list
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the allocation |
required |
expand |
bool |
indicates whether or not to return the expanded value with attributes/parameters for attributes with a base type of 'Attribute Expanded Text' |
True |
typed |
bool |
indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name |
True |
extra_allocations |
list[Allocation] |
allocations which are available to reference in the attribute list in addition to those associated with this AllocationAttribute |
[] |
Returns:
Type | Description |
---|---|
list |
the list of values of the attributes found with specified name |
get_attribute_set
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user |
User |
user for whom to return attributes |
required |
Returns:
Type | Description |
---|---|
list[AllocationAttribute] |
returns the set of attributes the user is allowed to see (if superuser, then all allocation attributes; else, only non-private ones) |
has_perm
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user |
User |
user to check permissions for |
required |
perm |
AllocationPermission |
permission to check for in user's list |
required |
Returns:
Type | Description |
---|---|
bool |
whether or not the user has the specified permission |
save
Saves the project.
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
set_usage
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
allocation attribute type whose usage to set |
required |
value |
float |
value to set usage to |
required |
user_permissions
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user |
User |
user for whom to return permissions |
required |
Returns:
Type | Description |
---|---|
list[AllocationPermission] |
list of user permissions for the allocation |
AllocationAccount (TimeStampedModel)
django-model
An allocation account
come back to
Attributes:
Name | Type | Description |
---|---|---|
user |
User |
represents the User object of the project user |
name |
str |
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name
user: ForeignKey
django-field
user
AllocationAdminNote (TimeStampedModel)
django-model
An allocation admin note is a note that an admin makes on an allocation.
Attributes:
Name | Type | Description |
---|---|---|
allocation |
Allocation |
links the allocation to the note |
author |
User |
represents the User class of the admin who authored the note |
note |
str |
text input from the user containing the note |
allocation: ForeignKey
django-field
allocation
author: ForeignKey
django-field
author
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
note: TextField
django-field
note
AllocationAttribute (TimeStampedModel)
django-model
An allocation attribute class links an allocation attribute type and an allocation.
Attributes:
Name | Type | Description |
---|---|---|
allocation_attribute_type |
AllocationAttributeType |
attribute type to link |
allocation |
Allocation |
allocation to link |
value |
str |
value of the allocation attribute |
allocation: ForeignKey
django-field
allocation
allocation_attribute_type: ForeignKey
django-field
allocation attribute type
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
value: CharField
django-field
value
clean
Validates the allocation attribute and raises errors if the allocation attribute is invalid.
expanded_value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
typed |
bool |
indicates whether or not to convert the attribute value to an int/ float/ str based on the base AttributeType name (unrecognized values not converted, so will return str) |
True |
extra_allocations |
list[Allocation] |
allocations which are available to reference in the attribute list in addition to those associated with this ResourceAttribute |
[] |
Returns:
Type | Description |
---|---|
int, float, str |
the value of the attribute after attribute expansion |
For attributes with attribute type of 'Attribute Expanded Text' we look for an attribute with same name suffixed with '_attriblist' (this should be ResourceAttribute of the Resource associated with the attribute). If the attriblist attribute is found, we use it to generate a dictionary to use to expand the attribute value, and the expanded value is returned.
If the expansion fails, or if no attriblist attribute is found, or if the attribute type is not 'Attribute Expanded Text', we just return the raw value.
save
Saves the allocation attribute.
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
typed_value
Returns:
Type | Description |
---|---|
int, float, str |
the value of the attribute with proper type and is used for computing expanded_value() (coerced into int or float for attributes with Int or Float types; if it fails or the attribute is of any other type, it is coerced into a str) |
AllocationAttributeChangeRequest (TimeStampedModel)
django-model
An allocation attribute change request represents a request from a PI/ manager to change their allocation attribute.
Attributes:
Name | Type | Description |
---|---|---|
allocation_change_request |
AllocationChangeRequest |
links the change request from which this attribute change is derived |
allocation_attribute |
AllocationAttribute |
represents the allocation_attribute to change |
new_value |
str |
new value of allocation attribute |
allocation_attribute: ForeignKey
django-field
allocation attribute
allocation_change_request: ForeignKey
django-field
allocation change request
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
new_value: CharField
django-field
new value
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
AllocationAttributeType (TimeStampedModel)
django-model
An allocation attribute type indicates the type of the attribute. Examples include Cloud Account Name and Core Usage (Hours).
Attributes:
Name | Type | Description |
---|---|---|
attribute_type |
AttributeType |
indicates the data type of the attribute |
name |
str |
name of allocation attribute type |
has_usage |
bool |
indicates whether or not the attribute type has usage |
is_required |
bool |
indicates whether or not the attribute is required |
is_unique |
bool |
indicates whether or not the value is unique |
is_private |
bool |
indicates whether or not the attribute type is private |
is_changeable |
bool |
indicates whether or not the attribute type is changeable |
attribute_type: ForeignKey
django-field
attribute type
created: AutoCreatedField
django-field
created
has_usage: BooleanField
django-field
has usage
is_changeable: BooleanField
django-field
is changeable
is_private: BooleanField
django-field
is private
is_required: BooleanField
django-field
is required
is_unique: BooleanField
django-field
is unique
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
AllocationAttributeUsage (TimeStampedModel)
django-model
Allocation attribute usage indicates the usage of an allocation attribute.
Attributes:
Name | Type | Description |
---|---|---|
allocation_attribute |
AllocationAttribute |
links the usage to its allocation attribute |
value |
float |
usage value of the allocation attribute |
allocation_attribute: OneToOneField
django-field
allocation attribute
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
value: FloatField
django-field
value
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
AllocationChangeRequest (TimeStampedModel)
django-model
An allocation change request represents a request from a PI or manager to change their allocation.
Attributes:
Name | Type | Description |
---|---|---|
allocation |
Allocation |
represents the allocation to change |
status |
AllocationStatusChoice |
represents the allocation status of the changed allocation |
end_date_extension |
int |
represents the number of days to extend the allocation's end date |
justification |
str |
represents input from the user justifying why they want to change the allocation |
notes |
str |
represents notes for users changing allocations |
allocation: ForeignKey
django-field
allocation
created: AutoCreatedField
django-field
created
end_date_extension: IntegerField
blank
django-field
nullable
end date extension
get_parent_resource
property
readonly
Returns:
Type | Description |
---|---|
Resource |
the parent resource for the allocation |
justification: TextField
django-field
justification
modified: AutoLastModifiedField
django-field
modified
notes: CharField
blank
django-field
nullable
notes
status: ForeignKey
django-field
Status
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
AllocationChangeStatusChoice (TimeStampedModel)
django-model
An allocation change status choice represents statuses displayed when a user changes their allocation status (for allocations that have their is_changeable attribute set to True). Examples include Expired and Payment Pending.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
status name |
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name
AllocationPermission (Enum)
A project permission stores the user and manager fields of a project.
AllocationStatusChoice (TimeStampedModel)
django-model
A project status choice indicates the status of the project. Examples include Active, Archived, and New.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
name of project status choice |
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name
AllocationUser (TimeStampedModel)
django-model
An allocation user represents a user on the allocation.
Attributes:
Name | Type | Description |
---|---|---|
allocation |
Allocation |
links user to its allocation |
user |
User |
represents the User object of the allocation user |
status |
ProjectUserStatus |
links the project user status choice to the user |
allocation: ForeignKey
django-field
allocation
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
status: ForeignKey
django-field
Allocation User Status
user: ForeignKey
django-field
user
save_without_historical_record
Save model without saving a historical record
Make sure you know what you're doing before you use this method.
AllocationUserNote (TimeStampedModel)
django-model
An allocation user note is a note that an user makes on an allocation.
Attributes:
Name | Type | Description |
---|---|---|
allocation |
Allocation |
links the allocation to the note |
author |
User |
represents the User class of the user who authored the note |
is_private |
bool |
indicates whether or not the note is private |
note |
str |
text input from the user containing the note |
allocation: ForeignKey
django-field
allocation
author: ForeignKey
django-field
author
created: AutoCreatedField
django-field
created
is_private: BooleanField
django-field
is private
modified: AutoLastModifiedField
django-field
modified
note: TextField
django-field
note
AllocationUserStatusChoice (TimeStampedModel)
django-model
An allocation user status choice indicates the status of an allocation user. Examples include Active, Error, and Removed.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
name of the allocation user status choice |
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name
AttributeType (TimeStampedModel)
django-model
An attribute type indicates the data type of the attribute. Examples include Date, Float, Int, Text, and Yes/No.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
name of attribute data type |
created: AutoCreatedField
django-field
created
modified: AutoLastModifiedField
django-field
modified
name: CharField
django-field
name