ferrosoft.apps.ferrobase.models package¶
Submodules¶
ferrosoft.apps.ferrobase.models.base module¶
- class ferrosoft.apps.ferrobase.models.base.AccessKeyMixin(*args, **kwargs)[source]¶
Bases:
UUIDModelMixin that adds a time-limited, single-use access key to a model.
The key is a SHA-256 hex digest generated from
settings.SECRET_KEYplus OS random bytes, stored inaccess_key. It expires after_DEFAULT_VALIDITY(1 day by default). Used for password-reset and account-activation tokens.- access_key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- access_key_expiry¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=True, **kwargs)¶
- get_previous_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.base.AddressMixin(*args, **kwargs)[source]¶
Bases:
UUIDModelAdd address fields to a model.
- additional_lines¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property address¶
- city¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- company¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- country¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- country_id¶
- first_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- house_no¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- postal_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- salutation¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- salutation_id¶
- street¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.base.CommonLimit(*values)[source]¶
Bases:
EnumDefines common limits for VARCHAR columns.
Its usage is DISCOURAGED, because PostgreSQL does not require an arbitrary limit on VARCHAR columns. There is also no performance benefit.
- BIG_CHAR = 2000¶
- NORMAL_CHAR = 1000¶
- TINY_CHAR = 100¶
- class ferrosoft.apps.ferrobase.models.base.CoordinatesMixin(*args, **kwargs)[source]¶
Bases:
UUIDModel- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- latitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- longitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.base.ISOCatalogEntry(*args, **kwargs)[source]¶
Bases:
UUIDModelAbstract base for ISO-coded catalog entities (countries, languages, etc.).
Subclasses store an
iso_code(unique), anenglish_name, and alocalized_name. The manager keeps entries sorted byiso_code.- english_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod id_mapping()[source]¶
Create mapping from ISO code to internal ID. Returns: dict
- Return type:
- iso_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- localized_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects¶
- class ferrosoft.apps.ferrobase.models.base.ISOCatalogEntryManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
ISOCatalogEntrymodels.Returns querysets ordered by
iso_codeby default and provides anupsertmethod for bulk-synchronising catalog data from release fixtures.
- class ferrosoft.apps.ferrobase.models.base.IntegerChoicesMixin(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntegerChoicesAdditional methods for IntegerChoices.
- class ferrosoft.apps.ferrobase.models.base.ObjectLookupCache(queryset, key_parts_func)[source]¶
Bases:
objectIn-memory lookup cache for a queryset of model instances.
Builds a dictionary indexed by a composite key derived from each object via
key_parts_func. Useful for bulk import operations that need fast repeated lookups without hitting the database on every iteration.
- exception ferrosoft.apps.ferrobase.models.base.PrefetchedFieldMissing(field_name)[source]¶
Bases:
RuntimeErrorRaised when a method requires a prefetched related field that was not loaded.
- class ferrosoft.apps.ferrobase.models.base.ReadOnlyMixin(*args, **kwargs)[source]¶
Bases:
UUIDModelModels can be marked read-only to prevent updates and deletions.
Generic views try to get this attribute from model instances to determine whether to enable certain functionality.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- read_only¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.base.SelectOptionsMixin[source]¶
Bases:
objectMixin that adds a
select_optionsclass method for use in HTML select widgets.Returns a list of
(pk_str, label)tuples ordered by the field named inorder_by_field(defaults to"name").
- class ferrosoft.apps.ferrobase.models.base.UUIDModel(*args, **kwargs)[source]¶
Bases:
ModelAbstract base model with a UUID v4 primary key.
All concrete models in Ferrobase should inherit from this class rather than Django’s default integer-keyed
Modelso that primary keys are opaque, globally unique, and safe to expose in URLs.- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ferrosoft.apps.ferrobase.models.base.prefetched_field(field_name, expected_type)[source]¶
Decorator that guards a method behind a prefetch-loaded related field.
Raises
PrefetchedFieldMissingwhen the named attribute on the instance is not an instance ofexpected_type, which typically means the queryset did not callprefetch_relatedbefore invoking the method.- Parameters:
field_name (
str) – Attribute name to inspect on the model instance.expected_type – Type the attribute must be an instance of.
- Returns:
- Decorated function that validates the prefetched field before
delegating to the original function.
- Return type:
Callable
ferrosoft.apps.ferrobase.models.builtin module¶
- class ferrosoft.apps.ferrobase.models.builtin.BuiltinSubscriptionPlan(plan, features)[source]¶
Bases:
object- features: Iterable[FeatureAssignment]¶
- plan: SubscriptionPlan¶
ferrosoft.apps.ferrobase.models.decimal module¶
- class ferrosoft.apps.ferrobase.models.decimal.DecimalWithUnit(value, unit)[source]¶
Bases:
objectDecimalWithUnit wraps a decimal with a unit of measurement.
- unit: MeasurementUnit | None¶
ferrosoft.apps.ferrobase.models.fields module¶
- class ferrosoft.apps.ferrobase.models.fields.BigDecimalField(*args, **kwargs)[source]¶
Bases:
CustomDecimalFieldDecimalField with max_digits and decimal_places useful for big values.
- class ferrosoft.apps.ferrobase.models.fields.BigMoneyField(*args, **kwargs)[source]¶
Bases:
CustomDecimalFieldDecimalField with max_digits and decimal_places useful for big money values.
- ROUND = Decimal('1.000')¶
- class ferrosoft.apps.ferrobase.models.fields.CoordinateDecimalField(*args, **kwargs)[source]¶
Bases:
CustomDecimalFieldDecimalField with max_digits and decimal_places useful for geographic coordinate.
- ROUND = Decimal('1.000000')¶
- class ferrosoft.apps.ferrobase.models.fields.CustomDecimalField(verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs)[source]¶
Bases:
DecimalFieldBase decimal field that omits
max_digits/decimal_placesfrom migrations.Subclasses hard-code these parameters so migrations stay clean. The
ROUNDclass attribute controls the quantization precision used by theroundclass method.- ROUND = Decimal('1.00')¶
- deconstruct()[source]¶
Return enough information to recreate the field as a 4-tuple:
The name of the field on the model, if contribute_to_class() has been run.
The import path of the field, including the class, e.g. django.db.models.IntegerField. This should be the most portable version, so less specific may be better.
A list of positional arguments.
A dict of keyword arguments.
Note that the positional or keyword arguments must contain values of the following types (including inner values of collection types):
None, bool, str, int, float, complex, set, frozenset, list, tuple, dict
UUID
datetime.datetime (naive), datetime.date
top-level classes, top-level functions - will be referenced by their full import path
Storage instances - these have their own deconstruct() method
This is because the values here must be serialized into a text format (possibly new Python code, possibly JSON) and these are the only types with encoding handlers defined.
There’s no need to return the exact way the field was instantiated this time, just ensure that the resulting field is the same - prefer keyword arguments over positional ones, and omit parameters with their default values.
- class ferrosoft.apps.ferrobase.models.fields.NormalDecimalField(*args, **kwargs)[source]¶
Bases:
CustomDecimalFieldDecimalField with max_digits and decimal_places useful for most cases.
- class ferrosoft.apps.ferrobase.models.fields.TonDecimalField(*args, **kwargs)[source]¶
Bases:
CustomDecimalFieldDecimalField with max_digits and decimal_places useful for tonnages not requiring any decimal places.
- ROUND = Decimal('1')¶
ferrosoft.apps.ferrobase.models.file module¶
- class ferrosoft.apps.ferrobase.models.file.AccessMode(*values)[source]¶
Bases:
IntegerChoicesAccess mode (read or write) for a
FileAccessGrant.- READ = 1¶
- WRITE = 2¶
- class ferrosoft.apps.ferrobase.models.file.AccessSubject(*values)[source]¶
Bases:
IntegerChoicesSubject who can access a file.
- ORGANIZATION = 2¶
Organization of the owner of the file.
- OWNER = 1¶
Owner is the creator of the file.
- PUBLIC = 3¶
Any logged-in user.
- class ferrosoft.apps.ferrobase.models.file.Directory(*args, **kwargs)[source]¶
Bases:
UUIDModelHierarchical folder structure for organising
StoredFileobjects.Directories can be nested via
parent_directory; anullparent indicates a root directory. Names must be unique within the same parent.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- directory_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- parent_directory¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- parent_directory_id¶
- storedfile_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class ferrosoft.apps.ferrobase.models.file.FileAccessGrant(*args, **kwargs)[source]¶
Bases:
UUIDModelRecords a single access permission for a
StoredFile.Each grant links a file to a subject (owner, organisation, or public) and a mode (read or write). The combination of file, subject, and mode is unique, preventing duplicate grants.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- file¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- file_id¶
- get_mode_display(*, field=<django.db.models.fields.IntegerField: mode>)¶
- get_subject_display(*, field=<django.db.models.fields.IntegerField: subject>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- mode¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- subject¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.file.FileInfo(file_name, media_type)[source]¶
Bases:
objectLightweight value object carrying the display name and media type of a file.
file_nameis the original name given by the user;media_typeis the MIME type string (e.g."application/pdf").
- class ferrosoft.apps.ferrobase.models.file.StoredFile(*args, **kwargs)[source]¶
Bases:
UUIDModelStoredFile wraps a Django file and enriches it with some metadata.
Name the file name given by the user.
Content is the file content.
Media type is the media/MIME type guessed by file name extension.
Directory is where the file is placed into (it has nothing to do with the location in STORAGES backend).
Creation time is when the file was created.
Owner is the user who can manage the file.
Beyond the owner attribute, no access control has been defined.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- access_grants¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- content¶
The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
- creation_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- directory¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- directory_id¶
- expire_on¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_creation_time(*, field=<django.db.models.fields.DateTimeField: creation_time>, is_next=True, **kwargs)¶
- get_previous_by_creation_time(*, field=<django.db.models.fields.DateTimeField: creation_time>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- media_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.file.StoredFileManager object>¶
- owner¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- owner_id¶
- transport_chains¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class ferrosoft.apps.ferrobase.models.file.StoredFileManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
StoredFilethat pre-fetches owner and directory relations.Also provides
create_with_access_grantsfor atomically creating a file together with its access control entries.
ferrosoft.apps.ferrobase.models.identity module¶
- class ferrosoft.apps.ferrobase.models.identity.APIToken(*args, **kwargs)[source]¶
Bases:
UUIDModelREST interface is authenticated with JWT’s. Token claims include a reference to this model, which informs about the user and which tenant to use for the request.
API middleware also inspects status and expiration and grants access only if the status is ACTIVE and the current time does not exceed expiration time.
In order to not rely too much on JWT, these fields are not encoded directly in the JWT, allowing for other authentication methods to be added.
Token name is purely informational for display in the UI.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- TOKEN_ID_CLAIM = 'token_id'¶
- expiration¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_expiration(*, field=<django.db.models.fields.DateTimeField: expiration>, is_next=True, **kwargs)¶
- get_previous_by_expiration(*, field=<django.db.models.fields.DateTimeField: expiration>, is_next=False, **kwargs)¶
- get_status_display(*, field=<django.db.models.fields.IntegerField: status>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.identity.APITokenPrefetchedManager object>¶
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- tenant¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- tenant_id¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- user_id¶
- class ferrosoft.apps.ferrobase.models.identity.APITokenPrefetchedManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
APITokenthat deeply pre-fetches user, organisation, and tenant.
- class ferrosoft.apps.ferrobase.models.identity.APITokenStatus(*values)[source]¶
Bases:
IntegerChoicesLifecycle state of an
APIToken.- ACTIVE = 1¶
- BLOCKED = 3¶
- INACTIVE = 2¶
- class ferrosoft.apps.ferrobase.models.identity.AccountActivationRequest(*args, **kwargs)[source]¶
Bases:
AccessKeyMixin,UUIDModelTime-limited token that activates a freshly provisioned tenant account.
Created when a new tenant is set up and sent to the contact email. The recipient follows the link containing
access_keyto confirm the account. Expired afterAccessKeyMixin._DEFAULT_VALIDITY.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- access_key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- access_key_expiry¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=True, **kwargs)¶
- get_previous_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- tenant¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- tenant_id¶
- class ferrosoft.apps.ferrobase.models.identity.Organization(*args, **kwargs)[source]¶
Bases:
UUIDModelTop-level entity representing a customer organisation.
An organisation owns one
SubscriptionPlanand contains one or moreTenantdatabases andUseraccounts. On save, the subscription tonnage limit Prometheus metric is updated so dashboards stay in sync.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- contact_email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- contact_first_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- contact_last_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- iam_reference¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.identity.OrganizationManager object>¶
- save(*, force_insert=False, force_update=False, using=None, update_fields=None)[source]¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- subscription¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- subscription_id¶
- tenants¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- users¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class ferrosoft.apps.ferrobase.models.identity.OrganizationManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
Organizationthat eagerly loads subscription and tenant relations.
- class ferrosoft.apps.ferrobase.models.identity.PasswordResetRequest(*args, **kwargs)[source]¶
Bases:
AccessKeyMixin,UUIDModelA password reset request is created upon the users request to reset a password.
It is deleted once the user changes the password.
This model is global to all tenants.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- access_key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- access_key_expiry¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod create(user)[source]¶
Create new request with random access key. :type user:
User:param user: For which user the request is created.
- get_next_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=True, **kwargs)¶
- get_previous_by_access_key_expiry(*, field=<django.db.models.fields.DateTimeField: access_key_expiry>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- user_id¶
- class ferrosoft.apps.ferrobase.models.identity.Tenant(*args, **kwargs)[source]¶
Bases:
UUIDModelTenant segregates entities from each other.
This model is global to all tenants.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- activate_connection(default=None)[source]¶
Fudge tenant database connection details into runtime configuration.
It is advisable to use activate_tenant_database instead of using this method directly.
- active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- database_hostname¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- database_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- database_password¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- database_port¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- database_username¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property django_connection¶
- expiry_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod find(tenant_id, active=True)[source]¶
Find tenant with given ID. :type tenant_id: :param tenant_id: :type active: :param active: Find only tenants which are active or not active (active by default).
- Return type:
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.identity.TenantManager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- organization_id¶
- class ferrosoft.apps.ferrobase.models.identity.TenantManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
Tenantthat eagerly loads the related organisation.
- class ferrosoft.apps.ferrobase.models.identity.User(*args, **kwargs)[source]¶
Bases:
AbstractUserExtends Django user model with fields required for Ferrosoft Platform.
This model is global to all tenants.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- MINIMUM_PASSWORD_LENGTH = 15¶
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- REQUIRED_FIELDS = ['email', 'organization_id']¶
- api_tokens¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- color_theme¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_joined¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- emaildevice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- first_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_color_theme_display(*, field=<django.db.models.fields.CharField: color_theme>)¶
- get_next_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)¶
- get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)¶
- groups¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_staff¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_superuser¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- language¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- language_id¶
- last_login¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- local_user()[source]¶
Find LocalUser corresponding to this user.
If the LocalUser does not exist, it is created implicitly.
Returns: LocalUser
- logentry_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <ferrosoft.apps.ferrobase.models.identity.UserManager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- organization_id¶
- password¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- passwordresetrequest_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- phonedevice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- staticdevice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- timezone¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- timezone_id¶
- totpdevice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- user_permissions¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- username¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
ferrosoft.apps.ferrobase.models.registry module¶
- class ferrosoft.apps.ferrobase.models.registry.AppFeatureBackend[source]¶
Bases:
BaseBackend- model¶
alias of
AppFeature
- objects = dict_values([<AppFeature: Users>, <AppFeature: API Access>, <AppFeature: ERP integration>, <AppFeature: Multi-tenancy>, <AppFeature: Reporting>, <AppFeature: Report CI>, <AppFeature: Report over whole year>])¶
- save_to_master_db_only = True¶
- class ferrosoft.apps.ferrobase.models.registry.BaseBackend[source]¶
Bases:
ABC- model = None¶
- objects = []¶
- save_to_master_db_only = False¶
- class ferrosoft.apps.ferrobase.models.registry.CountryBackend[source]¶
Bases:
BaseBackend- objects = [<Country: AF - Afghanistan>, <Country: AL - Albania>, <Country: DZ - Algeria>, <Country: AS - American Samoa>, <Country: AD - Andorra>, <Country: AO - Angola>, <Country: AI - Anguilla>, <Country: AQ - Antarctica>, <Country: AG - Antigua and Barbuda>, <Country: AR - Argentina>, <Country: AM - Armenia>, <Country: AW - Aruba>, <Country: AU - Australia>, <Country: AT - Austria>, <Country: AZ - Azerbaijan>, <Country: BS - Bahamas (the)>, <Country: BH - Bahrain>, <Country: BD - Bangladesh>, <Country: BB - Barbados>, <Country: BY - Belarus>, <Country: BE - Belgium>, <Country: BZ - Belize>, <Country: BJ - Benin>, <Country: BM - Bermuda>, <Country: BT - Bhutan>, <Country: BO - Bolivia (Plurinational State of)>, <Country: BQ - Bonaire, Sint Eustatius and Saba>, <Country: BA - Bosnia and Herzegovina>, <Country: BW - Botswana>, <Country: BV - Bouvet Island>, <Country: BR - Brazil>, <Country: IO - British Indian Ocean Territory (the)>, <Country: BN - Brunei Darussalam>, <Country: BG - Bulgaria>, <Country: BF - Burkina Faso>, <Country: BI - Burundi>, <Country: CV - Cabo Verde>, <Country: KH - Cambodia>, <Country: CM - Cameroon>, <Country: CA - Canada>, <Country: KY - Cayman Islands (the)>, <Country: CF - Central African Republic (the)>, <Country: TD - Chad>, <Country: CL - Chile>, <Country: CN - China>, <Country: CX - Christmas Island>, <Country: CC - Cocos (Keeling) Islands (the)>, <Country: CO - Colombia>, <Country: KM - Comoros (the)>, <Country: CD - Congo (the Democratic Republic of the)>, <Country: CG - Congo (the)>, <Country: CK - Cook Islands (the)>, <Country: CR - Costa Rica>, <Country: HR - Croatia>, <Country: CU - Cuba>, <Country: CW - Curaçao>, <Country: CY - Cyprus>, <Country: CZ - Czechia>, <Country: CI - Côte d'Ivoire>, <Country: DK - Denmark>, <Country: DJ - Djibouti>, <Country: DM - Dominica>, <Country: DO - Dominican Republic (the)>, <Country: EC - Ecuador>, <Country: EG - Egypt>, <Country: SV - El Salvador>, <Country: GQ - Equatorial Guinea>, <Country: ER - Eritrea>, <Country: EE - Estonia>, <Country: SZ - Eswatini>, <Country: ET - Ethiopia>, <Country: FK - Falkland Islands (the) [Malvinas]>, <Country: FO - Faroe Islands (the)>, <Country: FJ - Fiji>, <Country: FI - Finland>, <Country: FR - France>, <Country: GF - French Guiana>, <Country: PF - French Polynesia>, <Country: TF - French Southern Territories (the)>, <Country: GA - Gabon>, <Country: GM - Gambia (the)>, <Country: GE - Georgia>, <Country: DE - Germany>, <Country: GH - Ghana>, <Country: GI - Gibraltar>, <Country: GR - Greece>, <Country: GL - Greenland>, <Country: GD - Grenada>, <Country: GP - Guadeloupe>, <Country: GU - Guam>, <Country: GT - Guatemala>, <Country: GG - Guernsey>, <Country: GN - Guinea>, <Country: GW - Guinea-Bissau>, <Country: GY - Guyana>, <Country: HT - Haiti>, <Country: HM - Heard Island and McDonald Islands>, <Country: VA - Holy See (the)>, <Country: HN - Honduras>, <Country: HK - Hong Kong>, <Country: HU - Hungary>, <Country: IS - Iceland>, <Country: IN - India>, <Country: ID - Indonesia>, <Country: IR - Iran (Islamic Republic of)>, <Country: IQ - Iraq>, <Country: IE - Ireland>, <Country: IM - Isle of Man>, <Country: IL - Israel>, <Country: IT - Italy>, <Country: JM - Jamaica>, <Country: JP - Japan>, <Country: JE - Jersey>, <Country: JO - Jordan>, <Country: KZ - Kazakhstan>, <Country: KE - Kenya>, <Country: KI - Kiribati>, <Country: KP - Korea (the Democratic People's Republic of)>, <Country: KR - Korea (the Republic of)>, <Country: KW - Kuwait>, <Country: KG - Kyrgyzstan>, <Country: LA - Lao People's Democratic Republic (the)>, <Country: LV - Latvia>, <Country: LB - Lebanon>, <Country: LS - Lesotho>, <Country: LR - Liberia>, <Country: LY - Libya>, <Country: LI - Liechtenstein>, <Country: LT - Lithuania>, <Country: LU - Luxembourg>, <Country: MO - Macao>, <Country: MG - Madagascar>, <Country: MW - Malawi>, <Country: MY - Malaysia>, <Country: MV - Maldives>, <Country: ML - Mali>, <Country: MT - Malta>, <Country: MH - Marshall Islands (the)>, <Country: MQ - Martinique>, <Country: MR - Mauritania>, <Country: MU - Mauritius>, <Country: YT - Mayotte>, <Country: MX - Mexico>, <Country: FM - Micronesia (Federated States of)>, <Country: MD - Moldova (the Republic of)>, <Country: MC - Monaco>, <Country: MN - Mongolia>, <Country: ME - Montenegro>, <Country: MS - Montserrat>, <Country: MA - Morocco>, <Country: MZ - Mozambique>, <Country: MM - Myanmar>, <Country: NA - Namibia>, <Country: NR - Nauru>, <Country: NP - Nepal>, <Country: NL - Netherlands (the)>, <Country: NC - New Caledonia>, <Country: NZ - New Zealand>, <Country: NI - Nicaragua>, <Country: NE - Niger (the)>, <Country: NG - Nigeria>, <Country: NU - Niue>, <Country: NF - Norfolk Island>, <Country: MP - Northern Mariana Islands (the)>, <Country: NO - Norway>, <Country: OM - Oman>, <Country: PK - Pakistan>, <Country: PW - Palau>, <Country: PA - Panama>, <Country: PG - Papua New Guinea>, <Country: PY - Paraguay>, <Country: PE - Peru>, <Country: PH - Philippines (the)>, <Country: PN - Pitcairn>, <Country: PL - Poland>, <Country: PT - Portugal>, <Country: PR - Puerto Rico>, <Country: QA - Qatar>, <Country: MK - Republic of North Macedonia>, <Country: RO - Romania>, <Country: RU - Russian Federation (the)>, <Country: RW - Rwanda>, <Country: RE - Réunion>, <Country: BL - Saint Barthélemy>, <Country: SH - Saint Helena, Ascension and Tristan da Cunha>, <Country: KN - Saint Kitts and Nevis>, <Country: LC - Saint Lucia>, <Country: MF - Saint Martin (French part)>, <Country: PM - Saint Pierre and Miquelon>, <Country: VC - Saint Vincent and the Grenadines>, <Country: WS - Samoa>, <Country: SM - San Marino>, <Country: ST - Sao Tome and Principe>, <Country: SA - Saudi Arabia>, <Country: SN - Senegal>, <Country: RS - Serbia>, <Country: SC - Seychelles>, <Country: SL - Sierra Leone>, <Country: SG - Singapore>, <Country: SX - Sint Maarten (Dutch part)>, <Country: SK - Slovakia>, <Country: SI - Slovenia>, <Country: SB - Solomon Islands>, <Country: SO - Somalia>, <Country: ZA - South Africa>, <Country: GS - South Georgia and the South Sandwich Islands>, <Country: SS - South Sudan>, <Country: ES - Spain>, <Country: LK - Sri Lanka>, <Country: SD - Sudan (the)>, <Country: SR - Suriname>, <Country: SJ - Svalbard and Jan Mayen>, <Country: SE - Sweden>, <Country: CH - Switzerland>, <Country: SY - Syrian Arab Republic>, <Country: TW - Taiwan (Province of China)>, <Country: TJ - Tajikistan>, <Country: TZ - Tanzania, United Republic of>, <Country: TH - Thailand>, <Country: TL - Timor-Leste>, <Country: TG - Togo>, <Country: TK - Tokelau>, <Country: TO - Tonga>, <Country: TT - Trinidad and Tobago>, <Country: TN - Tunisia>, <Country: TR - Turkey>, <Country: TM - Turkmenistan>, <Country: TC - Turks and Caicos Islands (the)>, <Country: TV - Tuvalu>, <Country: UG - Uganda>, <Country: UA - Ukraine>, <Country: AE - United Arab Emirates (the)>, <Country: GB - United Kingdom of Great Britain and Northern Ireland (the)>, <Country: UM - United States Minor Outlying Islands (the)>, <Country: US - United States of America (the)>, <Country: UY - Uruguay>, <Country: UZ - Uzbekistan>, <Country: VU - Vanuatu>, <Country: VE - Venezuela (Bolivarian Republic of)>, <Country: VN - Viet Nam>, <Country: VG - Virgin Islands (British)>, <Country: VI - Virgin Islands (U.S.)>, <Country: WF - Wallis and Futuna>, <Country: EH - Western Sahara>, <Country: YE - Yemen>, <Country: ZM - Zambia>, <Country: ZW - Zimbabwe>, <Country: AX - Åland Islands>]¶
- class ferrosoft.apps.ferrobase.models.registry.LanguageBackend[source]¶
Bases:
BaseBackend- objects = [<Language: ab - аҧсуа бызшәа, аҧсшәа>, <Language: aa - Afaraf>, <Language: af - Afrikaans>, <Language: ak - Akan>, <Language: sq - Shqip>, <Language: am - አማርኛ>, <Language: ar - العربية>, <Language: an - aragonés>, <Language: hy - Հայերեն>, <Language: as - অসমীয়া>, <Language: av - авар мацӀ, магӀарул мацӀ>, <Language: ae - avesta>, <Language: ay - aymar aru>, <Language: az - azərbaycan dili>, <Language: bm - bamanankan>, <Language: ba - башҡорт теле>, <Language: eu - euskara, euskera>, <Language: be - беларуская мова>, <Language: bn - বাং>, <Language: bh - भोजपुरी>, <Language: bi - Bislama>, <Language: bs - bosanski jezik>, <Language: br - brezhoneg>, <Language: bg - български език>, <Language: my - ဗမာစာ>, <Language: ca - català, valencià>, <Language: ch - Chamoru>, <Language: ce - нохчийн мотт>, <Language: ny - chiCheŵa, chinyanja>, <Language: zh - 中文 (Zhōngwén), 汉语 / 漢語 (Hànyǔ)>, <Language: cv - чӑваш чӗлхи>, <Language: kw - Kernewek>, <Language: co - corsu, lingua corsa>, <Language: cr - ᓀᐦᐃᔭᐍᐏᐣ>, <Language: hr - hrvatski jezik>, <Language: cs - čeština, český jazyk>, <Language: da - dansk>, <Language: dv - ދިވެހި>, <Language: nl - Nederlands, Vlaams>, <Language: dz - རྫོང་ཁ>, <Language: en - English>, <Language: eo - Esperanto>, <Language: et - eesti, eesti keel>, <Language: ee - Eʋegbe>, <Language: fo - føroyskt>, <Language: fj - vosa Vakaviti>, <Language: fi - suomi, suomen kieli>, <Language: fr - français, langue française>, <Language: ff - Fulfulde, Pulaar, Pular>, <Language: gl - Galego>, <Language: ka - ქართული>, <Language: de - Deutsch>, <Language: el - ελληνικά>, <Language: gn - Avañe'ẽ>, <Language: gu - ગુજરાતી>, <Language: ht - Kreyòl ayisyen>, <Language: ha - هَوُسَ>, <Language: he - עברית>, <Language: hz - Otjiherero>, <Language: hi - हिन्दी, हिंदी>, <Language: ho - Hiri Motu>, <Language: hu - magyar>, <Language: ia - Interlingua>, <Language: id - Bahasa Indonesia>, <Language: ie - (ursprünglich:) Occidental, (nach 1945:) Interlingue>, <Language: ga - Gaeilge>, <Language: ig - Asụsụ Igbo>, <Language: ik - Iñupiaq, Iñupiatun>, <Language: io - Ido>, <Language: is - Íslenska>, <Language: it - Italiano>, <Language: iu - ᐃᓄᒃᑎᑐᑦ>, <Language: ja - 日本語, (にほんご Nihongo)>, <Language: jv - ꦧꦱꦗꦮ, Basa Jawa>, <Language: kl - kalaallisut, kalaallit oqaasii>, <Language: kn - ಕನ್ನಡ>, <Language: kr - Kanuri>, <Language: ks - कश्मीरी, كشميري>, <Language: kk - қазақ тілі>, <Language: km - ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ>, <Language: ki - Gĩkũyũ>, <Language: rw - Ikinyarwanda>, <Language: ky - Кыргызча, Кыргыз тили>, <Language: kv - коми кыв>, <Language: kg - Kikongo>, <Language: ko - 한국어 (韓國語, Hangugeo)>, <Language: ku - Kurdî, کوردی>, <Language: kj - Kuanyama>, <Language: la - latine, lingua latina>, <Language: lb - Lëtzebuergesch>, <Language: lg - Luganda>, <Language: li - Limburgs>, <Language: ln - Lingála>, <Language: lo - ພາສາລາວ>, <Language: lt - lietuvių kalba>, <Language: lu - Kiluba>, <Language: lv - latviešu valoda>, <Language: gv - Gaelg, Gailck>, <Language: mk - македонски јазик>, <Language: mg - fiteny malagasy>, <Language: ms - Bahasa Melayu, بهاس ملايو>, <Language: ml - മലയാളം>, <Language: mt - Malti>, <Language: mi - te reo Māori>, <Language: mr - मराठी>, <Language: mh - Kajin Ṃajeḷ>, <Language: mn - Монгол хэл>, <Language: na - Dorerin Naoero>, <Language: nv - Diné bizaad>, <Language: nd - isiNdebele>, <Language: ne - नेपाली>, <Language: ng - Owambo>, <Language: nb - Norsk Bokmål>, <Language: nn - Norsk Nynorsk>, <Language: no - Norsk>, <Language: ii - ꆈꌠ꒿, Nuosuhxop>, <Language: nr - isiNdebele>, <Language: oc - occitan, lenga d'òc>, <Language: oj - ᐊᓂᔑᓈᐯᒧᐎᓐ>, <Language: cu - ѩзыкъ словѣньскъ>, <Language: om - Afaan Oromoo>, <Language: or - ଓଡ଼ିଆ>, <Language: os - ирон æвзаг>, <Language: pa - ਪੰਜਾਬੀ>, <Language: pi - पालि, पाळि>, <Language: fa - فارسی>, <Language: pl - język polski, polszczyzna>, <Language: ps - پښتو>, <Language: pt - Português>, <Language: qu - Runa Simi, Kichwa>, <Language: rm - Rumantsch, Romontsch, Rumauntsch>, <Language: rn - Ikirundi>, <Language: ro - Română>, <Language: ru - русский>, <Language: sa - संस्कृतम्>, <Language: sc - sardu>, <Language: sd - सिन्धी, سنڌي، سندھی>, <Language: se - Davvisámegiella>, <Language: (sh) - српскохрватски, srpskohrvatski>, <Language: sm - gagana fa'a Samoa>, <Language: sg - yângâ tî sängö>, <Language: sr - српски језик, srpski jezik>, <Language: gd - Gàidhlig>, <Language: sn - chiShona>, <Language: si - සිංල>, <Language: sk - slovenčina, slovenský jazyk>, <Language: sl - slovenski jezik, slovenščina>, <Language: so - Soomaaliga, af Soomaali>, <Language: st - Sesotho>, <Language: es - Español>, <Language: su - Basa Sunda>, <Language: sw - Kiswahili>, <Language: ss - SiSwati>, <Language: sv - Svenska>, <Language: ta - தமிழ்>, <Language: te - తెలుగు>, <Language: tg - тоҷикӣ, toçikī, تاجیکی>, <Language: th - ไทย>, <Language: ti - ትግርኛ>, <Language: bo - བོད་ཡིག>, <Language: tk - Türkmen, Түркмен>, <Language: tl - Wikang Tagalog>, <Language: tn - Setswana>, <Language: to - Faka Tonga>, <Language: tr - Türkçe>, <Language: ts - Xitsonga>, <Language: tt - татар теле, tatar tele>, <Language: tw - Twi>, <Language: ty - Reo Tahiti>, <Language: ug - Uyghurche, ئۇيغۇرچە>, <Language: uk - Українська>, <Language: ur - اردو>, <Language: uz - Oʻzbek, Ўзбек, أۇزبېك>, <Language: ve - Tshivenḓa>, <Language: vi - Tiếng Việt>, <Language: vo - Volapük>, <Language: wa - Walon>, <Language: cy - Cymraeg>, <Language: wo - Wollof>, <Language: fy - Frysk>, <Language: xh - isiXhosa>, <Language: yi - ייִדיש>, <Language: yo - Yorùbá>, <Language: za - Saɯ cueŋƅ, Saw cuengh>, <Language: zu - isiZulu>]¶
- save_to_master_db_only = True¶
- class ferrosoft.apps.ferrobase.models.registry.SubscriptionPlanRegistry[source]¶
Bases:
BaseBackend- model¶
alias of
SubscriptionPlan
- objects = [BuiltinSubscriptionPlan(plan=<SubscriptionPlan: Demo>, features=[<FeatureAssignment: Users (limit: 1)>]), BuiltinSubscriptionPlan(plan=<SubscriptionPlan: Basic>, features=[<FeatureAssignment: Users (limit: 2)>, <FeatureAssignment: Reporting>]), BuiltinSubscriptionPlan(plan=<SubscriptionPlan: Business>, features=[<FeatureAssignment: Users>, <FeatureAssignment: API Access>, <FeatureAssignment: Reporting>, <FeatureAssignment: Report over whole year>]), BuiltinSubscriptionPlan(plan=<SubscriptionPlan: Enterprise>, features=[<FeatureAssignment: Users>, <FeatureAssignment: API Access>, <FeatureAssignment: Reporting>, <FeatureAssignment: Report over whole year>]), BuiltinSubscriptionPlan(plan=<SubscriptionPlan: Unlimited>, features=[])]¶
- save_to_master_db_only = True¶
- class ferrosoft.apps.ferrobase.models.registry.TimeZoneBackend[source]¶
Bases:
BaseBackend- objects = [<TimeZone: Africa/Abidjan>, <TimeZone: Africa/Algiers>, <TimeZone: Africa/Bissau>, <TimeZone: Africa/Cairo>, <TimeZone: Africa/Casablanca>, <TimeZone: Africa/Ceuta>, <TimeZone: Africa/El_Aaiun>, <TimeZone: Africa/Johannesburg>, <TimeZone: Africa/Juba>, <TimeZone: Africa/Khartoum>, <TimeZone: Africa/Lagos>, <TimeZone: Africa/Maputo>, <TimeZone: Africa/Monrovia>, <TimeZone: Africa/Nairobi>, <TimeZone: Africa/Ndjamena>, <TimeZone: Africa/Sao_Tome>, <TimeZone: Africa/Tripoli>, <TimeZone: Africa/Tunis>, <TimeZone: Africa/Windhoek>, <TimeZone: America/Adak>, <TimeZone: America/Anchorage>, <TimeZone: America/Araguaina>, <TimeZone: America/Argentina/Buenos_Aires>, <TimeZone: America/Argentina/Catamarca>, <TimeZone: America/Argentina/Cordoba>, <TimeZone: America/Argentina/Jujuy>, <TimeZone: America/Argentina/La_Rioja>, <TimeZone: America/Argentina/Mendoza>, <TimeZone: America/Argentina/Rio_Gallegos>, <TimeZone: America/Argentina/Salta>, <TimeZone: America/Argentina/San_Juan>, <TimeZone: America/Argentina/San_Luis>, <TimeZone: America/Argentina/Tucuman>, <TimeZone: America/Argentina/Ushuaia>, <TimeZone: America/Asuncion>, <TimeZone: America/Bahia>, <TimeZone: America/Bahia_Banderas>, <TimeZone: America/Barbados>, <TimeZone: America/Belem>, <TimeZone: America/Belize>, <TimeZone: America/Boa_Vista>, <TimeZone: America/Bogota>, <TimeZone: America/Boise>, <TimeZone: America/Cambridge_Bay>, <TimeZone: America/Campo_Grande>, <TimeZone: America/Cancun>, <TimeZone: America/Caracas>, <TimeZone: America/Cayenne>, <TimeZone: America/Chicago>, <TimeZone: America/Chihuahua>, <TimeZone: America/Ciudad_Juarez>, <TimeZone: America/Costa_Rica>, <TimeZone: America/Cuiaba>, <TimeZone: America/Danmarkshavn>, <TimeZone: America/Dawson>, <TimeZone: America/Dawson_Creek>, <TimeZone: America/Denver>, <TimeZone: America/Detroit>, <TimeZone: America/Edmonton>, <TimeZone: America/Eirunepe>, <TimeZone: America/El_Salvador>, <TimeZone: America/Fort_Nelson>, <TimeZone: America/Fortaleza>, <TimeZone: America/Glace_Bay>, <TimeZone: America/Goose_Bay>, <TimeZone: America/Grand_Turk>, <TimeZone: America/Guatemala>, <TimeZone: America/Guayaquil>, <TimeZone: America/Guyana>, <TimeZone: America/Halifax>, <TimeZone: America/Havana>, <TimeZone: America/Hermosillo>, <TimeZone: America/Indiana/Indianapolis>, <TimeZone: America/Indiana/Knox>, <TimeZone: America/Indiana/Marengo>, <TimeZone: America/Indiana/Petersburg>, <TimeZone: America/Indiana/Tell_City>, <TimeZone: America/Indiana/Vevay>, <TimeZone: America/Indiana/Vincennes>, <TimeZone: America/Indiana/Winamac>, <TimeZone: America/Inuvik>, <TimeZone: America/Iqaluit>, <TimeZone: America/Jamaica>, <TimeZone: America/Juneau>, <TimeZone: America/Kentucky/Louisville>, <TimeZone: America/Kentucky/Monticello>, <TimeZone: America/La_Paz>, <TimeZone: America/Lima>, <TimeZone: America/Los_Angeles>, <TimeZone: America/Maceio>, <TimeZone: America/Managua>, <TimeZone: America/Manaus>, <TimeZone: America/Martinique>, <TimeZone: America/Matamoros>, <TimeZone: America/Mazatlan>, <TimeZone: America/Menominee>, <TimeZone: America/Merida>, <TimeZone: America/Metlakatla>, <TimeZone: America/Mexico_City>, <TimeZone: America/Miquelon>, <TimeZone: America/Moncton>, <TimeZone: America/Monterrey>, <TimeZone: America/Montevideo>, <TimeZone: America/New_York>, <TimeZone: America/Nome>, <TimeZone: America/Noronha>, <TimeZone: America/North_Dakota/Beulah>, <TimeZone: America/North_Dakota/Center>, <TimeZone: America/North_Dakota/New_Salem>, <TimeZone: America/Nuuk>, <TimeZone: America/Ojinaga>, <TimeZone: America/Panama>, <TimeZone: America/Paramaribo>, <TimeZone: America/Phoenix>, <TimeZone: America/Port-au-Prince>, <TimeZone: America/Porto_Velho>, <TimeZone: America/Puerto_Rico>, <TimeZone: America/Punta_Arenas>, <TimeZone: America/Rankin_Inlet>, <TimeZone: America/Recife>, <TimeZone: America/Regina>, <TimeZone: America/Resolute>, <TimeZone: America/Rio_Branco>, <TimeZone: America/Santarem>, <TimeZone: America/Santiago>, <TimeZone: America/Santo_Domingo>, <TimeZone: America/Sao_Paulo>, <TimeZone: America/Scoresbysund>, <TimeZone: America/Sitka>, <TimeZone: America/St_Johns>, <TimeZone: America/Swift_Current>, <TimeZone: America/Tegucigalpa>, <TimeZone: America/Thule>, <TimeZone: America/Tijuana>, <TimeZone: America/Toronto>, <TimeZone: America/Vancouver>, <TimeZone: America/Whitehorse>, <TimeZone: America/Winnipeg>, <TimeZone: America/Yakutat>, <TimeZone: Antarctica/Casey>, <TimeZone: Antarctica/Davis>, <TimeZone: Antarctica/Macquarie>, <TimeZone: Antarctica/Mawson>, <TimeZone: Antarctica/Palmer>, <TimeZone: Antarctica/Rothera>, <TimeZone: Antarctica/Troll>, <TimeZone: Asia/Almaty>, <TimeZone: Asia/Amman>, <TimeZone: Asia/Anadyr>, <TimeZone: Asia/Aqtau>, <TimeZone: Asia/Aqtobe>, <TimeZone: Asia/Ashgabat>, <TimeZone: Asia/Atyrau>, <TimeZone: Asia/Baghdad>, <TimeZone: Asia/Baku>, <TimeZone: Asia/Bangkok>, <TimeZone: Asia/Barnaul>, <TimeZone: Asia/Beirut>, <TimeZone: Asia/Bishkek>, <TimeZone: Asia/Chita>, <TimeZone: Asia/Choibalsan>, <TimeZone: Asia/Colombo>, <TimeZone: Asia/Damascus>, <TimeZone: Asia/Dhaka>, <TimeZone: Asia/Dili>, <TimeZone: Asia/Dubai>, <TimeZone: Asia/Dushanbe>, <TimeZone: Asia/Famagusta>, <TimeZone: Asia/Gaza>, <TimeZone: Asia/Hebron>, <TimeZone: Asia/Ho_Chi_Minh>, <TimeZone: Asia/Hong_Kong>, <TimeZone: Asia/Hovd>, <TimeZone: Asia/Irkutsk>, <TimeZone: Asia/Jakarta>, <TimeZone: Asia/Jayapura>, <TimeZone: Asia/Jerusalem>, <TimeZone: Asia/Kabul>, <TimeZone: Asia/Kamchatka>, <TimeZone: Asia/Karachi>, <TimeZone: Asia/Kathmandu>, <TimeZone: Asia/Khandyga>, <TimeZone: Asia/Kolkata>, <TimeZone: Asia/Krasnoyarsk>, <TimeZone: Asia/Kuching>, <TimeZone: Asia/Macau>, <TimeZone: Asia/Magadan>, <TimeZone: Asia/Makassar>, <TimeZone: Asia/Manila>, <TimeZone: Asia/Nicosia>, <TimeZone: Asia/Novokuznetsk>, <TimeZone: Asia/Novosibirsk>, <TimeZone: Asia/Omsk>, <TimeZone: Asia/Oral>, <TimeZone: Asia/Pontianak>, <TimeZone: Asia/Pyongyang>, <TimeZone: Asia/Qatar>, <TimeZone: Asia/Qostanay>, <TimeZone: Asia/Qyzylorda>, <TimeZone: Asia/Riyadh>, <TimeZone: Asia/Sakhalin>, <TimeZone: Asia/Samarkand>, <TimeZone: Asia/Seoul>, <TimeZone: Asia/Shanghai>, <TimeZone: Asia/Singapore>, <TimeZone: Asia/Srednekolymsk>, <TimeZone: Asia/Taipei>, <TimeZone: Asia/Tashkent>, <TimeZone: Asia/Tbilisi>, <TimeZone: Asia/Tehran>, <TimeZone: Asia/Thimphu>, <TimeZone: Asia/Tokyo>, <TimeZone: Asia/Tomsk>, <TimeZone: Asia/Ulaanbaatar>, <TimeZone: Asia/Urumqi>, <TimeZone: Asia/Ust-Nera>, <TimeZone: Asia/Vladivostok>, <TimeZone: Asia/Yakutsk>, <TimeZone: Asia/Yangon>, <TimeZone: Asia/Yekaterinburg>, <TimeZone: Asia/Yerevan>, <TimeZone: Atlantic/Azores>, <TimeZone: Atlantic/Bermuda>, <TimeZone: Atlantic/Canary>, <TimeZone: Atlantic/Cape_Verde>, <TimeZone: Atlantic/Faroe>, <TimeZone: Atlantic/Madeira>, <TimeZone: Atlantic/South_Georgia>, <TimeZone: Atlantic/Stanley>, <TimeZone: Australia/Adelaide>, <TimeZone: Australia/Brisbane>, <TimeZone: Australia/Broken_Hill>, <TimeZone: Australia/Darwin>, <TimeZone: Australia/Eucla>, <TimeZone: Australia/Hobart>, <TimeZone: Australia/Lindeman>, <TimeZone: Australia/Lord_Howe>, <TimeZone: Australia/Melbourne>, <TimeZone: Australia/Perth>, <TimeZone: Australia/Sydney>, <TimeZone: CET>, <TimeZone: CST6CDT>, <TimeZone: EET>, <TimeZone: EST>, <TimeZone: EST5EDT>, <TimeZone: Etc/GMT>, <TimeZone: Etc/GMT+1>, <TimeZone: Etc/GMT+10>, <TimeZone: Etc/GMT+11>, <TimeZone: Etc/GMT+12>, <TimeZone: Etc/GMT+2>, <TimeZone: Etc/GMT+3>, <TimeZone: Etc/GMT+4>, <TimeZone: Etc/GMT+5>, <TimeZone: Etc/GMT+6>, <TimeZone: Etc/GMT+7>, <TimeZone: Etc/GMT+8>, <TimeZone: Etc/GMT+9>, <TimeZone: Etc/GMT-1>, <TimeZone: Etc/GMT-10>, <TimeZone: Etc/GMT-11>, <TimeZone: Etc/GMT-12>, <TimeZone: Etc/GMT-13>, <TimeZone: Etc/GMT-14>, <TimeZone: Etc/GMT-2>, <TimeZone: Etc/GMT-3>, <TimeZone: Etc/GMT-4>, <TimeZone: Etc/GMT-5>, <TimeZone: Etc/GMT-6>, <TimeZone: Etc/GMT-7>, <TimeZone: Etc/GMT-8>, <TimeZone: Etc/GMT-9>, <TimeZone: Etc/UTC>, <TimeZone: Europe/Andorra>, <TimeZone: Europe/Astrakhan>, <TimeZone: Europe/Athens>, <TimeZone: Europe/Belgrade>, <TimeZone: Europe/Berlin>, <TimeZone: Europe/Brussels>, <TimeZone: Europe/Bucharest>, <TimeZone: Europe/Budapest>, <TimeZone: Europe/Chisinau>, <TimeZone: Europe/Dublin>, <TimeZone: Europe/Gibraltar>, <TimeZone: Europe/Helsinki>, <TimeZone: Europe/Istanbul>, <TimeZone: Europe/Kaliningrad>, <TimeZone: Europe/Kirov>, <TimeZone: Europe/Kyiv>, <TimeZone: Europe/Lisbon>, <TimeZone: Europe/London>, <TimeZone: Europe/Madrid>, <TimeZone: Europe/Malta>, <TimeZone: Europe/Minsk>, <TimeZone: Europe/Moscow>, <TimeZone: Europe/Paris>, <TimeZone: Europe/Prague>, <TimeZone: Europe/Riga>, <TimeZone: Europe/Rome>, <TimeZone: Europe/Samara>, <TimeZone: Europe/Saratov>, <TimeZone: Europe/Simferopol>, <TimeZone: Europe/Sofia>, <TimeZone: Europe/Tallinn>, <TimeZone: Europe/Tirane>, <TimeZone: Europe/Ulyanovsk>, <TimeZone: Europe/Vienna>, <TimeZone: Europe/Vilnius>, <TimeZone: Europe/Volgograd>, <TimeZone: Europe/Warsaw>, <TimeZone: Europe/Zurich>, <TimeZone: Factory>, <TimeZone: HST>, <TimeZone: Indian/Chagos>, <TimeZone: Indian/Maldives>, <TimeZone: Indian/Mauritius>, <TimeZone: MET>, <TimeZone: MST>, <TimeZone: MST7MDT>, <TimeZone: Pacific/Apia>, <TimeZone: Pacific/Auckland>, <TimeZone: Pacific/Bougainville>, <TimeZone: Pacific/Chatham>, <TimeZone: Pacific/Easter>, <TimeZone: Pacific/Efate>, <TimeZone: Pacific/Fakaofo>, <TimeZone: Pacific/Fiji>, <TimeZone: Pacific/Galapagos>, <TimeZone: Pacific/Gambier>, <TimeZone: Pacific/Guadalcanal>, <TimeZone: Pacific/Guam>, <TimeZone: Pacific/Honolulu>, <TimeZone: Pacific/Kanton>, <TimeZone: Pacific/Kiritimati>, <TimeZone: Pacific/Kosrae>, <TimeZone: Pacific/Kwajalein>, <TimeZone: Pacific/Marquesas>, <TimeZone: Pacific/Nauru>, <TimeZone: Pacific/Niue>, <TimeZone: Pacific/Norfolk>, <TimeZone: Pacific/Noumea>, <TimeZone: Pacific/Pago_Pago>, <TimeZone: Pacific/Palau>, <TimeZone: Pacific/Pitcairn>, <TimeZone: Pacific/Port_Moresby>, <TimeZone: Pacific/Rarotonga>, <TimeZone: Pacific/Tahiti>, <TimeZone: Pacific/Tarawa>, <TimeZone: Pacific/Tongatapu>, <TimeZone: PST8PDT>, <TimeZone: WET>]¶
- save_to_master_db_only = True¶
- class ferrosoft.apps.ferrobase.models.registry.UnifiedBackend[source]¶
Bases:
BaseBackendModel registries act as an in-memory storage for model instances.
This is used for models of fixed set size, which are defined once, such as measurement units.
- AppFeature = <ferrosoft.apps.ferrobase.models.registry.AppFeatureBackend object>¶
- Country = <ferrosoft.apps.ferrobase.models.registry.CountryBackend object>¶
- Language = <ferrosoft.apps.ferrobase.models.registry.LanguageBackend object>¶
- SubscriptionPlan = <ferrosoft.apps.ferrobase.models.registry.SubscriptionPlanRegistry object>¶
- TimeZone = <ferrosoft.apps.ferrobase.models.registry.TimeZoneBackend object>¶
- Unit = <ferrosoft.apps.ferrobase.models.registry.UnitRegistry object>¶
- class ferrosoft.apps.ferrobase.models.registry.UnitRegistry[source]¶
Bases:
BaseBackendUnit registry provides all supported measurement units.
It is storing units in-memory to avoid hitting database for lookups by ID or unit cursor.
- model¶
alias of
MeasurementUnit
ferrosoft.apps.ferrobase.models.subscription module¶
- class ferrosoft.apps.ferrobase.models.subscription.AppFeature(*args, **kwargs)[source]¶
Bases:
UUIDModelA toggleable platform feature identified by a stable string
code.Features are assigned to
SubscriptionPlaninstances viaFeatureAssignment, optionally with a numeric limit.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.subscription.AppFeatureManager object>¶
- class ferrosoft.apps.ferrobase.models.subscription.AppFeatureManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
AppFeaturewith a bulk upsert keyed oncode.
- class ferrosoft.apps.ferrobase.models.subscription.FeatureAssignment(*args, **kwargs)[source]¶
Bases:
ModelThrough model linking an
AppFeatureto aSubscriptionPlanwith an optional numeric limit.The meaning of
limitis feature-specific (e.g. maximum number of allowed users). Settinglimitto0disables any limit check for that feature.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- feature¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- feature_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- limit¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.subscription.FeatureAssignmentModel object>¶
- plan¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- plan_id¶
- class ferrosoft.apps.ferrobase.models.subscription.FeatureAssignmentModel(*args, **kwargs)[source]¶
Bases:
ManagerManager for
FeatureAssignmentthat pre-fetches the related feature and supports bulk upsert.
- class ferrosoft.apps.ferrobase.models.subscription.SubscriptionPlan(*args, **kwargs)[source]¶
Bases:
UUIDModelDefines a subscription tier that controls which features and tonnage cap an organisation gets.
When
enable_all_featuresisTrue, feature-gate checks are bypassed regardless of theFeatureAssignmententries.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- assigned_features¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- enable_all_features¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- features¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- max_tonnage¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.subscription.SubscriptionPlanManager object>¶
ferrosoft.apps.ferrobase.models.units module¶
- class ferrosoft.apps.ferrobase.models.units.MeasurementUnit(*args, **kwargs)[source]¶
Bases:
UUIDModelA physical unit of measurement identified by a symbol and a
UnitSystem.The combination of
symbolandsystemis unique so that, for example, the imperial"ft"and the US customary"ft"are separate entries. Equality comparison supportsUnitCursorand plain symbol strings (implicitly metric) for convenience.- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- property cursor: UnitCursor¶
- property fraction: Tuple[str, str]¶
Get tuple of denominator and divider of the symbol, if it is a fraction.
Raise exception if it is not a fraction.
- get_system_display(*, field=<django.db.models.fields.IntegerField: system>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <ferrosoft.apps.ferrobase.models.units.MeasurementUnitManager object>¶
- symbol¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- system¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class ferrosoft.apps.ferrobase.models.units.MeasurementUnitManager(*args, **kwargs)[source]¶
Bases:
ManagerManager for
MeasurementUnitwith bulk-lookup and upsert helpers.
- exception ferrosoft.apps.ferrobase.models.units.UndefinedUnit[source]¶
Bases:
ExceptionRaised when a unit symbol or cursor cannot be resolved to a known
MeasurementUnit.
- class ferrosoft.apps.ferrobase.models.units.UnitCategory(*values)[source]¶
Bases:
IntEnumPhysical quantity category used to group
UnitCollectionentries.- DISTANCE = 1¶
- EMISSION_FACTOR = 3¶
- EMISSION_VALUE = 2¶
- ENERGY = 4¶
- MASS = 5¶
- NATIVE_CONSUMPTION = 6¶
- class ferrosoft.apps.ferrobase.models.units.UnitCollection[source]¶
Bases:
objectPre-defined sets of
UnitCursorobjects organised by physical quantity.Each class attribute is a list of
UnitCursorinstances covering the supported units for that quantity across allUnitSystemvalues. Used to populateUnitChoiceFieldand to seed theMeasurementUnittable duringferrobase_update.- DISTANCE = [UnitCursor(symbol='km', system=UnitSystem.METRIC), UnitCursor(symbol='m', system=UnitSystem.METRIC), UnitCursor(symbol='ft', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='yd', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='mi', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='le', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='ftm', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cb', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='nmi', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='ft', system=UnitSystem.IMPERIAL), UnitCursor(symbol='yd', system=UnitSystem.IMPERIAL), UnitCursor(symbol='ch', system=UnitSystem.IMPERIAL), UnitCursor(symbol='fur', system=UnitSystem.IMPERIAL), UnitCursor(symbol='mile', system=UnitSystem.IMPERIAL), UnitCursor(symbol='lea', system=UnitSystem.IMPERIAL), UnitCursor(symbol='ftm', system=UnitSystem.IMPERIAL), UnitCursor(symbol='cb', system=UnitSystem.IMPERIAL), UnitCursor(symbol='nmi', system=UnitSystem.IMPERIAL)]¶
- EMISSION = [UnitCursor(symbol='gCO2e', system=UnitSystem.METRIC), UnitCursor(symbol='kgCO2e', system=UnitSystem.METRIC), UnitCursor(symbol='tCO2e', system=UnitSystem.METRIC)]¶
- EMISSION_FACTOR = [UnitCursor(symbol='kgCO2e/kg', system=UnitSystem.METRIC), UnitCursor(symbol='gCO2e/MJ', system=UnitSystem.METRIC)]¶
- ENERGY = [UnitCursor(symbol='MJ/L', system=UnitSystem.METRIC), UnitCursor(symbol='MJ/kg', system=UnitSystem.METRIC), UnitCursor(symbol='MJ/kWh', system=UnitSystem.METRIC)]¶
- MASS = [UnitCursor(symbol='kg', system=UnitSystem.METRIC), UnitCursor(symbol='t', system=UnitSystem.METRIC), UnitCursor(symbol='oz', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='lb', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cwt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='long cwt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='st', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='ton', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='dw t', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='oz t', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='lb t', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='oz', system=UnitSystem.IMPERIAL), UnitCursor(symbol='lb', system=UnitSystem.IMPERIAL), UnitCursor(symbol='st', system=UnitSystem.IMPERIAL), UnitCursor(symbol='qr', system=UnitSystem.IMPERIAL), UnitCursor(symbol='cwt', system=UnitSystem.IMPERIAL), UnitCursor(symbol='ton', system=UnitSystem.IMPERIAL)]¶
- NATIVE_CONSUMPTION = [UnitCursor(symbol='kg', system=UnitSystem.METRIC), UnitCursor(symbol='L', system=UnitSystem.METRIC), UnitCursor(symbol='kWh', system=UnitSystem.METRIC), UnitCursor(symbol='cu in', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cu ft', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cu yd', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='acre ft', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US fl oz', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US cup', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US pt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US qt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pot', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US gal', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='oil bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='hhd', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='qt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='gal', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pk', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='bu', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='dry bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='fl oz', system=UnitSystem.IMPERIAL), UnitCursor(symbol='gi', system=UnitSystem.IMPERIAL), UnitCursor(symbol='pt', system=UnitSystem.IMPERIAL), UnitCursor(symbol='qt', system=UnitSystem.IMPERIAL), UnitCursor(symbol='gal', system=UnitSystem.IMPERIAL)]¶
- VOLUMETRIC = [UnitCursor(symbol='L', system=UnitSystem.METRIC), UnitCursor(symbol='cu in', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cu ft', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='cu yd', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='acre ft', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US fl oz', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US cup', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US pt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US qt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pot', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='US gal', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='oil bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='hhd', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='qt', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='gal', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='pk', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='bu', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='dry bbl', system=UnitSystem.US_CUSTOMARY), UnitCursor(symbol='fl oz', system=UnitSystem.IMPERIAL), UnitCursor(symbol='gi', system=UnitSystem.IMPERIAL), UnitCursor(symbol='pt', system=UnitSystem.IMPERIAL), UnitCursor(symbol='qt', system=UnitSystem.IMPERIAL), UnitCursor(symbol='gal', system=UnitSystem.IMPERIAL)]¶
- class ferrosoft.apps.ferrobase.models.units.UnitCursor(symbol, system=UnitSystem.METRIC)[source]¶
Bases:
objectUsed for lookup of units in UnitRegistry
- system: UnitSystem = 0¶
- ferrosoft.apps.ferrobase.models.units.UnitRef = str | uuid.UUID | ferrosoft.apps.ferrobase.models.units.MeasurementUnit | ferrosoft.apps.ferrobase.models.units.UnitCursor¶
Measurement units can be retrieved by values of these types. A string is treated as the unit symbol (and implicit metric unit system).