Skip to content

Mixin classes documentation

This document lists all mixin classes found in the Waldur codebase.

Mixin Name Module Short Description
CopyButtonMixin waldur_core.core.admin Mixin to add copy-to-clipboard functionality to form fields in Django admin
ExcludedFieldsAdminMixin waldur_core.core.admin This mixin allows to toggle display of fields in Django model admin according...
ExtraActionsMixin waldur_core.core.admin Allows to add extra actions to admin list page
ExtraActionsObjectMixin waldur_core.core.admin Allows to add extra actions to admin object edit page
HideAdminOriginalMixin waldur_core.core.admin Encapsulate all admin options and functionality for a given model
NativeNameAdminMixin waldur_core.core.admin This mixin allows to toggle display of fields in Django model admin according...
ReadOnlyAdminMixin waldur_core.core.admin Disables all editing capabilities
DeleteExecutorMixin waldur_core.core.executors Delete object on success or if force flag is enabled
ErrorExecutorMixin waldur_core.core.executors Set object as erred on fail
SuccessExecutorMixin waldur_core.core.executors Set object as OK on success, cleanup action and its details
GenericKeyMixin waldur_core.core.managers Filtering by generic key field Support filtering by: - generic key directly...
CreateExecutorMixin waldur_core.core.mixins Mixin to execute create operations using background executors
DeleteExecutorMixin waldur_core.core.mixins Mixin to execute delete operations using background executors
EagerLoadMixin waldur_core.core.mixins Reduce number of requests to DB
ExecutorMixin waldur_core.core.mixins Execute create/update/delete operation with executor
GetValueMixin waldur_core.core.mixins Mixin to provide helper method for getting values from attrs or instance
ReviewMixin waldur_core.core.mixins An abstract base class model that provides self-updating created and ``mo...
ReviewStateMixin waldur_core.core.mixins Make subclasses preserve the alters_data attribute on overridden methods
ScopeMixin waldur_core.core.mixins Make subclasses preserve the alters_data attribute on overridden methods
UpdateExecutorMixin waldur_core.core.mixins Mixin to execute update operations using background executors
ActionMixin waldur_core.core.models Mixin to add a standardized "error_message" and "error_traceback" fields
BackendMixin waldur_core.core.models Mixin to add standard backend_id field
BackendModelMixin waldur_core.core.models Represents model that is connected to backend object
DescendantMixin waldur_core.core.models Mixin to provide child-parent relationships
DescribableMixin waldur_core.core.models Mixin to add a standardized "description" field
ErrorMessageMixin waldur_core.core.models Mixin to add a standardized "error_message" and "error_traceback" fields
LastSyncMixin waldur_core.core.models Make subclasses preserve the alters_data attribute on overridden methods
NameMixin waldur_core.core.models Mixin to add a standardized "name" field
RuntimeStateMixin waldur_core.core.models Provide runtime_state field
SlugMixin waldur_core.core.models Mixin to automatically generate a name-based slug
StateMixin waldur_core.core.models Mixin to add a standardized "error_message" and "error_traceback" fields
UiDescribableMixin waldur_core.core.models Mixin to add a standardized "description" and "icon url" fields
UserDetailsMixin waldur_core.core.models This mixin is shared by User and Invitation model
UuidMixin waldur_core.core.models Mixin to identify models by UUID
LookupMixin waldur_core.core.nested_routers Deprecated
NestedMixin waldur_core.core.nested_routers Mixin for creating nested routers that handle hierarchical URL structures
AugmentedSerializerMixin waldur_core.core.serializers This mixin provides several extensions to stock Serializer class: 1
RestrictedSerializerMixin waldur_core.core.serializers This mixin allows to specify list of fields to be rendered by serializer
SlugSerializerMixin waldur_core.core.serializers Ensures that slug is editable only by staff
TranslatedModelSerializerMixin waldur_core.core.serializers A ModelSerializer is just a regular Serializer, except that: * A set of ...
ExtensionTaskMixin waldur_core.core.tasks This mixin allows to skip task scheduling if extension is disabled
ActionMethodMixin waldur_core.core.views Implements helper methods for viewset when use separate nested endpoints for ...
CheckExtensionMixin waldur_core.core.views Raise exception if extension is disabled
ConstanceCheckExtensionMixin waldur_core.core.views Raise exception if extension is disabled
CreateReversionMixin waldur_core.core.views Mixin to automatically create revision tracking for create operations
UpdateReversionMixin waldur_core.core.views Mixin to automatically create revision tracking for update operations
LoggableMixin waldur_core.logging.mixins Mixin to serialize model in logs
EventTypesMixin waldur_core.logging.models Mixin to add a event_types and event_groups fields
UuidMixin waldur_core.logging.models Make subclasses preserve the alters_data attribute on overridden methods
ImageModelMixin waldur_core.media.mixins Make subclasses preserve the alters_data attribute on overridden methods
PermissionMixin waldur_core.permissions.mixins Base permission management mixin for customer and project
UserRoleMixin waldur_core.permissions.views Mixin to provide user role management functionality for viewsets
ExtendableQuotaModelMixin waldur_core.quotas.models Allows to add quotas to model in runtime
QuotaModelMixin waldur_core.quotas.models Add general fields and methods to model for quotas usage
SharedQuotaMixin waldur_core.quotas.models This mixin updates quotas for several scopes
ChangeReadonlyMixin waldur_core.structure.admin Mixin to set different readonly fields for add and change views in Django admin
FormRequestAdminMixin waldur_core.structure.admin This mixin allows you to get current request user in the model admin form, wh...
ProtectedModelMixin waldur_core.structure.admin Mixin to handle protected model deletion errors gracefully in Django admin
CoordinatesMixin waldur_core.structure.mixins Mixin to add a latitude and longitude fields
IPCoordinatesMixin waldur_core.structure.mixins Mixin to add a latitude and longitude fields
CustomerDetailsMixin waldur_core.structure.models Mixin to add a standardized "name" field
ProjectOECDFOS2007CodeMixin waldur_core.structure.models Make subclasses preserve the alters_data attribute on overridden methods
ServiceAccountMixin waldur_core.structure.models Mixin for models that support service accounts
StructureLoggableMixin waldur_core.structure.models Mixin to serialize model in logs
VATMixin waldur_core.structure.models Add country, VAT number fields and check results from EU VAT Information Exch...
CountrySerializerMixin waldur_core.structure.serializers The BaseSerializer class provides a minimal class which may be used for writi...
FieldFilteringMixin waldur_core.structure.serializers Mixin allowing to filter fields by user
PermissionFieldFilteringMixin waldur_core.structure.serializers Mixin allowing to filter related fields
SshPublicKeySerializerMixin waldur_core.structure.serializers A type of ModelSerializer that uses hyperlinked relationships instead of pr...
CheckExtensionMixin waldur_freeipa.views Raise exception if extension is disabled
PeriodMixin waldur_mastermind.invoices.models Make subclasses preserve the alters_data attribute on overridden methods
ConnectedResourceMixin waldur_mastermind.marketplace.admin Protects object from modification if there are connected resources
ParentInlineMixin waldur_mastermind.marketplace.admin Mixin to get parent object from request in Django admin inline views
OfferingFilterMixin waldur_mastermind.marketplace.filters Mixin to provide common offering-related filters
CostEstimateMixin waldur_mastermind.marketplace.models Make subclasses preserve the alters_data attribute on overridden methods
RequestTypeMixin waldur_mastermind.marketplace.models Make subclasses preserve the alters_data attribute on overridden methods
ResourceDetailsMixin waldur_mastermind.marketplace.models Mixin to add a standardized "name" field
SafeAttributesMixin waldur_mastermind.marketplace.models Make subclasses preserve the alters_data attribute on overridden methods
ConnectedOfferingDetailsMixin waldur_mastermind.marketplace.views Mixin to provide offering details action for connected resources
PublicViewsetMixin waldur_mastermind.marketplace.views Mixin to allow anonymous access to offerings when configured
TenantMixin waldur_mastermind.marketplace_openstack.processors No description available
SelectiveDNSMockMixin waldur_mastermind.marketplace_remote.tests.dns_utils Mixin class that provides selective DNS mocking for test classes
ContainerExecutorMixin waldur_mastermind.marketplace_script.utils Mixin to execute scripts in containers for marketplace script processing
EstimatedCostPolicyMixin waldur_mastermind.policy.models Make subclasses preserve the alters_data attribute on overridden methods
OfferingPolicySerializerMixin waldur_mastermind.policy.serializers This mixin provides several extensions to stock Serializer class: 1
BackendNameMixin waldur_mastermind.support.models Make subclasses preserve the alters_data attribute on overridden methods
FileMixin waldur_mastermind.support.models Mixin to provide file-related functionality and properties
CheckExtensionMixin waldur_mastermind.support.views Raise exception if extension is disabled
ActionDetailsMixin waldur_openstack.admin Encapsulate all admin options and functionality for a given model
ImageMetadataMixin waldur_openstack.admin Encapsulate all admin options and functionality for a given model
MetadataMixin waldur_openstack.admin Encapsulate all admin options and functionality for a given model
TenantQuotaMixin waldur_openstack.models It allows to update both service settings and shared tenant quotas
LimitedPerTypeThrottleMixin waldur_openstack.tasks No description available
TenantMixin waldur_openstack.tests.factories No description available
DataciteMixin waldur_pid.mixins A marker model for models that can be registered with PIDs and referred to in...
RoleMixin waldur_rancher.models Make subclasses preserve the alters_data attribute on overridden methods
SettingsMixin waldur_rancher.models Make subclasses preserve the alters_data attribute on overridden methods
SyncDestroyMixin waldur_rancher.views No description available
YamlMixin waldur_rancher.views No description available
UsageMixin waldur_slurm.models Make subclasses preserve the alters_data attribute on overridden methods
VirtualMachineMixin waldur_vmware.models Make subclasses preserve the alters_data attribute on overridden methods

Detailed Descriptions

CopyButtonMixin

Module: waldur_core.core.admin

Description: Mixin to add copy-to-clipboard functionality to form fields in Django admin.

ExcludedFieldsAdminMixin

Module: waldur_core.core.admin

Description: This mixin allows to toggle display of fields in Django model admin according to custom logic. It's expected that inherited class has implemented excluded_fields property.

Base classes: ModelAdmin

ExtraActionsMixin

Module: waldur_core.core.admin

Description: Allows to add extra actions to admin list page.

ExtraActionsObjectMixin

Module: waldur_core.core.admin

Description: Allows to add extra actions to admin object edit page.

HideAdminOriginalMixin

Module: waldur_core.core.admin

Description: Encapsulate all admin options and functionality for a given model.

Base classes: ModelAdmin

NativeNameAdminMixin

Module: waldur_core.core.admin

Description: This mixin allows to toggle display of fields in Django model admin according to custom logic. It's expected that inherited class has implemented excluded_fields property.

Base classes: ExcludedFieldsAdminMixin

ReadOnlyAdminMixin

Module: waldur_core.core.admin

Description: Disables all editing capabilities. Please ensure that readonly_fields is specified in derived class.

DeleteExecutorMixin

Module: waldur_core.core.executors

Description: Delete object on success or if force flag is enabled

ErrorExecutorMixin

Module: waldur_core.core.executors

Description: Set object as erred on fail.

SuccessExecutorMixin

Module: waldur_core.core.executors

Description: Set object as OK on success, cleanup action and its details.

GenericKeyMixin

Module: waldur_core.core.managers

Description: Filtering by generic key field

Support filtering by: - generic key directly: = - is generic key null: __isnull=True|False

CreateExecutorMixin

Module: waldur_core.core.mixins

Description: Mixin to execute create operations using background executors.

Base classes: AsyncExecutor

DeleteExecutorMixin

Module: waldur_core.core.mixins

Description: Mixin to execute delete operations using background executors.

Base classes: AsyncExecutor

EagerLoadMixin

Module: waldur_core.core.mixins

Description: Reduce number of requests to DB.

Serializer should implement static method "eager_load", that selects objects that are necessary for serialization.

ExecutorMixin

Module: waldur_core.core.mixins

Description: Execute create/update/delete operation with executor

Base classes: CreateExecutorMixin, UpdateExecutorMixin, DeleteExecutorMixin

GetValueMixin

Module: waldur_core.core.mixins

Description: Mixin to provide helper method for getting values from attrs or instance.

ReviewMixin

Module: waldur_core.core.mixins

Description: An abstract base class model that provides self-updating created and modified fields.

Base classes: ReviewStateMixin, TimeStampedModel

ReviewStateMixin

Module: waldur_core.core.mixins

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

ScopeMixin

Module: waldur_core.core.mixins

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

UpdateExecutorMixin

Module: waldur_core.core.mixins

Description: Mixin to execute update operations using background executors.

Base classes: AsyncExecutor

ActionMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "error_message" and "error_traceback" fields.

Base classes: StateMixin

BackendMixin

Module: waldur_core.core.models

Description: Mixin to add standard backend_id field.

Base classes: Model

BackendModelMixin

Module: waldur_core.core.models

Description: Represents model that is connected to backend object.

This model cannot be created or updated via admin, because we do not support queries to backend from admin interface.

DescendantMixin

Module: waldur_core.core.models

Description: Mixin to provide child-parent relationships. Each related model can provide list of its parents.

DescribableMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "description" field.

Base classes: Model

ErrorMessageMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "error_message" and "error_traceback" fields.

Base classes: Model

LastSyncMixin

Module: waldur_core.core.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

NameMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "name" field.

Base classes: Model

RuntimeStateMixin

Module: waldur_core.core.models

Description: Provide runtime_state field

Base classes: Model

SlugMixin

Module: waldur_core.core.models

Description: Mixin to automatically generate a name-based slug.

Base classes: Model

StateMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "error_message" and "error_traceback" fields.

Base classes: ErrorMessageMixin, ConcurrentTransitionMixin

UiDescribableMixin

Module: waldur_core.core.models

Description: Mixin to add a standardized "description" and "icon url" fields.

Base classes: DescribableMixin

UserDetailsMixin

Module: waldur_core.core.models

Description: This mixin is shared by User and Invitation model. All fields are optional. User is populated with these details when invitation is approved. Note that civil_number and email fields are not included in this mixin because they have different constraints in User and Invitation model.

Base classes: Model

UuidMixin

Module: waldur_core.core.models

Description: Mixin to identify models by UUID.

Base classes: Model

LookupMixin

Module: waldur_core.core.nested_routers

Description: Deprecated.

No method override is needed since Django Rest Framework 2.4.

NestedMixin

Module: waldur_core.core.nested_routers

Description: Mixin for creating nested routers that handle hierarchical URL structures.

AugmentedSerializerMixin

Module: waldur_core.core.serializers

Description: This mixin provides several extensions to stock Serializer class:

  1. Add extra fields to serializer from dependent applications in a way that doesn't introduce circular dependencies.

    To achieve this, dependent application should subscribe to pre_serializer_fields signal and inject additional fields.

    Example of signal handler implementation:

    from waldur_core.structure.serializers import CustomerSerializer

    def add_customer_name(sender, fields, **kwargs): fields['customer_name'] = ReadOnlyField(source='customer.name')

    pre_serializer_fields.connect( handlers.add_customer_name, sender=CustomerSerializer )

  2. Declaratively add attributes fields of related entities for ModelSerializers.

    To achieve list related fields whose attributes you want to include.

    Example: class ProjectSerializer(AugmentedSerializerMixin, serializers.HyperlinkedModelSerializer): class Meta: model = models.Project fields = ( 'url', 'uuid', 'name', 'customer', 'customer_uuid', 'customer_name', ) related_paths = ('customer',)

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    # This is equivalent to listing the fields explicitly,
    # by default "uuid" and "name" fields of related object are added:
    
    class ProjectSerializer(AugmentedSerializerMixin,
                            serializers.HyperlinkedModelSerializer):
        customer_uuid = serializers.UUIDField(read_only=True, source='customer.uuid')
        customer_name = serializers.ReadOnlyField(source='customer.name')
        class Meta:
            model = models.Project
            fields = (
                'url', 'uuid', 'name',
                'customer', 'customer_uuid', 'customer_name',
            )
            lookup_field = 'uuid'
    
    # The fields of related object can be customized:
    
    class ProjectSerializer(AugmentedSerializerMixin,
                            serializers.HyperlinkedModelSerializer):
        class Meta:
            model = models.Project
            fields = (
                'url', 'uuid', 'name',
                'customer', 'customer_uuid',
                'customer_name', 'customer_native_name',
            )
            related_paths = {
                'customer': ('uuid', 'name', 'native_name')
            }
    
  3. Protect some fields from change.

    Example: class ProjectSerializer(AugmentedSerializerMixin, serializers.HyperlinkedModelSerializer): class Meta: model = models.Project fields = ('url', 'uuid', 'name', 'customer') protected_fields = ('customer',)

  4. This mixin overrides "get_extra_kwargs" method and puts "view_name" to extra_kwargs or uses URL name specified in a model of serialized object.

RestrictedSerializerMixin

Module: waldur_core.core.serializers

Description: This mixin allows to specify list of fields to be rendered by serializer. It expects that request is available in serializer's context.

SlugSerializerMixin

Module: waldur_core.core.serializers

Description: Ensures that slug is editable only by staff

Base classes: Serializer

TranslatedModelSerializerMixin

Module: waldur_core.core.serializers

Description: A ModelSerializer is just a regular Serializer, except that:

  • A set of default fields are automatically populated.
  • A set of default validators are automatically populated.
  • Default .create() and .update() implementations are provided.

The process of automatically determining a set of serializer fields based on the model fields is reasonably complex, but you almost certainly don't need to dig into the implementation.

If the ModelSerializer class doesn't generate the set of fields that you need you should either declare the extra/differing fields explicitly on the serializer class, or simply use a Serializer class.

Base classes: ModelSerializer

ExtensionTaskMixin

Module: waldur_core.core.tasks

Description: This mixin allows to skip task scheduling if extension is disabled. Subclasses should implement "is_extension_disabled" method which returns boolean value.

Base classes: Task

ActionMethodMixin

Module: waldur_core.core.views

Description: Implements helper methods for viewset when use separate nested endpoints for create/edit relations objects. Example:

@decorators.action(detail=True, methods=["get", "post"]) def offerings(self, request, uuid=None): return self.action_list_method("requestedoffering_set")(self, request, uuid)

offerings_serializer_class = serializers.RequestedOfferingSerializer

def offering_detail(self, request, uuid=None, obj_uuid=None): return self.action_detail_method( "requestedoffering_set", delete_validators=[], update_validators=[ core_validators.StateValidator( RequestedOfferingStates.REQUESTED ) ], )(self, request, uuid, obj_uuid)

offering_detail_serializer_class = serializers.RequestedOfferingSerializer

CheckExtensionMixin

Module: waldur_core.core.views

Description: Raise exception if extension is disabled

ConstanceCheckExtensionMixin

Module: waldur_core.core.views

Description: Raise exception if extension is disabled

CreateReversionMixin

Module: waldur_core.core.views

Description: Mixin to automatically create revision tracking for create operations.

UpdateReversionMixin

Module: waldur_core.core.views

Description: Mixin to automatically create revision tracking for update operations.

LoggableMixin

Module: waldur_core.logging.mixins

Description: Mixin to serialize model in logs. Extends django model or custom class with fields extraction method.

EventTypesMixin

Module: waldur_core.logging.models

Description: Mixin to add a event_types and event_groups fields.

Base classes: Model

UuidMixin

Module: waldur_core.logging.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

ImageModelMixin

Module: waldur_core.media.mixins

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

PermissionMixin

Module: waldur_core.permissions.mixins

Description: Base permission management mixin for customer and project. It is expected that reverse permissions relation is created for this model. Provides method to grant, revoke and check object permissions.

UserRoleMixin

Module: waldur_core.permissions.views

Description: Mixin to provide user role management functionality for viewsets.

ExtendableQuotaModelMixin

Module: waldur_core.quotas.models

Description: Allows to add quotas to model in runtime.

Example: from waldur_core.quotas.fields import QuotaField

1
2
3
4
QuotaScopeModel.add_quota_field(
    name='quota_name',
    quota_field=QuotaField(...),
)

Base classes: QuotaModelMixin

QuotaModelMixin

Module: waldur_core.quotas.models

Description: Add general fields and methods to model for quotas usage.

Model with quotas have inherit this mixin. For quotas implementation such methods and fields have to be defined: - class Quota(QuotaModelMixin) - class with quotas fields as attributes.

Example: Customer(models.Model): ... Quotas(quotas_models.QuotaModelMixin.Quotas): nc_user_count = quotas_fields.QuotaField() # define user count quota for customers

Use such methods to change objects quotas: set_quota_limit, set_quota_usage, add_quota_usage.

Base classes: Model

SharedQuotaMixin

Module: waldur_core.quotas.models

Description: This mixin updates quotas for several scopes.

ChangeReadonlyMixin

Module: waldur_core.structure.admin

Description: Mixin to set different readonly fields for add and change views in Django admin.

FormRequestAdminMixin

Module: waldur_core.structure.admin

Description: This mixin allows you to get current request user in the model admin form, which then passed to add_user method, so that user which granted role, is stored in the permission model.

ProtectedModelMixin

Module: waldur_core.structure.admin

Description: Mixin to handle protected model deletion errors gracefully in Django admin.

CoordinatesMixin

Module: waldur_core.structure.mixins

Description: Mixin to add a latitude and longitude fields

Base classes: Model

IPCoordinatesMixin

Module: waldur_core.structure.mixins

Description: Mixin to add a latitude and longitude fields

Base classes: CoordinatesMixin

CustomerDetailsMixin

Module: waldur_core.structure.models

Description: Mixin to add a standardized "name" field.

Base classes: NameMixin, VATMixin, CoordinatesMixin

ProjectOECDFOS2007CodeMixin

Module: waldur_core.structure.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

ServiceAccountMixin

Module: waldur_core.structure.models

Description: Mixin for models that support service accounts.

Base classes: Model

StructureLoggableMixin

Module: waldur_core.structure.models

Description: Mixin to serialize model in logs. Extends django model or custom class with fields extraction method.

Base classes: LoggableMixin

VATMixin

Module: waldur_core.structure.models

Description: Add country, VAT number fields and check results from EU VAT Information Exchange System. Allows to compute VAT charge rate.

Base classes: Model

CountrySerializerMixin

Module: waldur_core.structure.serializers

Description: The BaseSerializer class provides a minimal class which may be used for writing custom serializer implementations.

Note that we strongly restrict the ordering of operations/properties that may be used on the serializer in order to enforce correct usage.

In particular, if a data= argument is passed then:

.is_valid() - Available. .initial_data - Available. .validated_data - Only available after calling is_valid() .errors - Only available after calling is_valid() .data - Only available after calling is_valid()

If a data= argument is not passed then:

.is_valid() - Not available. .initial_data - Not available. .validated_data - Not available. .errors - Not available. .data - Available.

Base classes: Serializer

FieldFilteringMixin

Module: waldur_core.structure.serializers

Description: Mixin allowing to filter fields by user.

In order to constrain the list of fields implement get_filtered_field() method returning list of tuples (field name, func for check access).

PermissionFieldFilteringMixin

Module: waldur_core.structure.serializers

Description: Mixin allowing to filter related fields.

In order to constrain the list of entities that can be used as a value for the field:

  1. Make sure that the entity in question has corresponding Permission class defined.

  2. Implement get_filtered_field_names() method in the class that this mixin is mixed into and return the field in question from that method.

SshPublicKeySerializerMixin

Module: waldur_core.structure.serializers

Description: A type of ModelSerializer that uses hyperlinked relationships instead of primary key relationships. Specifically:

  • A 'url' field is included instead of the 'id' field.
  • Relationships to other instances are hyperlinks, instead of primary keys.

Base classes: HyperlinkedModelSerializer

CheckExtensionMixin

Module: waldur_freeipa.views

Description: Raise exception if extension is disabled

Base classes: ConstanceCheckExtensionMixin

PeriodMixin

Module: waldur_mastermind.invoices.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

ConnectedResourceMixin

Module: waldur_mastermind.marketplace.admin

Description: Protects object from modification if there are connected resources.

ParentInlineMixin

Module: waldur_mastermind.marketplace.admin

Description: Mixin to get parent object from request in Django admin inline views.

OfferingFilterMixin

Module: waldur_mastermind.marketplace.filters

Description: Mixin to provide common offering-related filters.

Base classes: FilterSet

CostEstimateMixin

Module: waldur_mastermind.marketplace.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

RequestTypeMixin

Module: waldur_mastermind.marketplace.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: CostEstimateMixin

ResourceDetailsMixin

Module: waldur_mastermind.marketplace.models

Description: Mixin to add a standardized "name" field.

Base classes: SafeAttributesMixin, CostEstimateMixin, NameMixin, SlugMixin, DescribableMixin

SafeAttributesMixin

Module: waldur_mastermind.marketplace.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

ConnectedOfferingDetailsMixin

Module: waldur_mastermind.marketplace.views

Description: Mixin to provide offering details action for connected resources.

PublicViewsetMixin

Module: waldur_mastermind.marketplace.views

Description: Mixin to allow anonymous access to offerings when configured.

TenantMixin

Module: waldur_mastermind.marketplace_openstack.processors

Description: No description available.

SelectiveDNSMockMixin

Module: waldur_mastermind.marketplace_remote.tests.dns_utils

Description: Mixin class that provides selective DNS mocking for test classes.

Usage: class MyTestClass(SelectiveDNSMockMixin, test.APITransactionTestCase): def setUp(self): super().setUp() # Your additional setup code here

ContainerExecutorMixin

Module: waldur_mastermind.marketplace_script.utils

Description: Mixin to execute scripts in containers for marketplace script processing.

EstimatedCostPolicyMixin

Module: waldur_mastermind.policy.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: PeriodMixin

OfferingPolicySerializerMixin

Module: waldur_mastermind.policy.serializers

Description: This mixin provides several extensions to stock Serializer class:

  1. Add extra fields to serializer from dependent applications in a way that doesn't introduce circular dependencies.

    To achieve this, dependent application should subscribe to pre_serializer_fields signal and inject additional fields.

    Example of signal handler implementation:

    from waldur_core.structure.serializers import CustomerSerializer

    def add_customer_name(sender, fields, **kwargs): fields['customer_name'] = ReadOnlyField(source='customer.name')

    pre_serializer_fields.connect( handlers.add_customer_name, sender=CustomerSerializer )

  2. Declaratively add attributes fields of related entities for ModelSerializers.

    To achieve list related fields whose attributes you want to include.

    Example: class ProjectSerializer(AugmentedSerializerMixin, serializers.HyperlinkedModelSerializer): class Meta: model = models.Project fields = ( 'url', 'uuid', 'name', 'customer', 'customer_uuid', 'customer_name', ) related_paths = ('customer',)

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    # This is equivalent to listing the fields explicitly,
    # by default "uuid" and "name" fields of related object are added:
    
    class ProjectSerializer(AugmentedSerializerMixin,
                            serializers.HyperlinkedModelSerializer):
        customer_uuid = serializers.UUIDField(read_only=True, source='customer.uuid')
        customer_name = serializers.ReadOnlyField(source='customer.name')
        class Meta:
            model = models.Project
            fields = (
                'url', 'uuid', 'name',
                'customer', 'customer_uuid', 'customer_name',
            )
            lookup_field = 'uuid'
    
    # The fields of related object can be customized:
    
    class ProjectSerializer(AugmentedSerializerMixin,
                            serializers.HyperlinkedModelSerializer):
        class Meta:
            model = models.Project
            fields = (
                'url', 'uuid', 'name',
                'customer', 'customer_uuid',
                'customer_name', 'customer_native_name',
            )
            related_paths = {
                'customer': ('uuid', 'name', 'native_name')
            }
    
  3. Protect some fields from change.

    Example: class ProjectSerializer(AugmentedSerializerMixin, serializers.HyperlinkedModelSerializer): class Meta: model = models.Project fields = ('url', 'uuid', 'name', 'customer') protected_fields = ('customer',)

  4. This mixin overrides "get_extra_kwargs" method and puts "view_name" to extra_kwargs or uses URL name specified in a model of serialized object.

Base classes: AugmentedSerializerMixin

BackendNameMixin

Module: waldur_mastermind.support.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

FileMixin

Module: waldur_mastermind.support.models

Description: Mixin to provide file-related functionality and properties.

CheckExtensionMixin

Module: waldur_mastermind.support.views

Description: Raise exception if extension is disabled

Base classes: ConstanceCheckExtensionMixin

ActionDetailsMixin

Module: waldur_openstack.admin

Description: Encapsulate all admin options and functionality for a given model.

Base classes: ModelAdmin

ImageMetadataMixin

Module: waldur_openstack.admin

Description: Encapsulate all admin options and functionality for a given model.

Base classes: ModelAdmin

MetadataMixin

Module: waldur_openstack.admin

Description: Encapsulate all admin options and functionality for a given model.

Base classes: ModelAdmin

TenantQuotaMixin

Module: waldur_openstack.models

Description: It allows to update both service settings and shared tenant quotas.

Base classes: SharedQuotaMixin

LimitedPerTypeThrottleMixin

Module: waldur_openstack.tasks

Description: No description available.

TenantMixin

Module: waldur_openstack.tests.factories

Description: No description available.

DataciteMixin

Module: waldur_pid.mixins

Description: A marker model for models that can be registered with PIDs and referred to in a Datacite PID way.

Base classes: Model

RoleMixin

Module: waldur_rancher.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

SettingsMixin

Module: waldur_rancher.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

SyncDestroyMixin

Module: waldur_rancher.views

Description: No description available.

YamlMixin

Module: waldur_rancher.views

Description: No description available.

UsageMixin

Module: waldur_slurm.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model

VirtualMachineMixin

Module: waldur_vmware.models

Description: Make subclasses preserve the alters_data attribute on overridden methods.

Base classes: Model