rattail.db.model.core
¶
Core Data Models
- class rattail.db.model.core.ModelBase[source]¶
Base class for all data models.
- model_title¶
Optionally set this to a “humanized” version of the model name, for display in templates etc. Default value will be guessed from the model class name, e.g. ‘Product’ => “Products” and ‘CustomerOrder’ => “Customer Order”.
- model_title_plural¶
Optionally set this to a “humanized” version of the plural model name, for display in templates etc. Default value will be guessed from the model class name, e.g. ‘Product’ => “Products” and ‘CustomerOrder’ => “Customer Orders”.
- class rattail.db.model.core.Setting(**kwargs)[source]¶
Represents a “raw” config setting stored within the database.
- class rattail.db.model.core.Change(**kwargs)[source]¶
Represents a changed (or deleted) record, which is pending synchronization to another database.
- instance_uuid¶
Key for the object which was changed/etc. In most cases this will simply be the object’s UUID value, hence the column name. However in some cases it may contain something else; this is often needed in order to properly sync deletions to non-rattail systems, where the UUID is meaningless.
- object_key¶
Synonym to the
instance_uuid
column. New code should perhaps reference the attribute by this (object_key
) name instead, as theinstance_uuid
column may be renamed at some point, to this name.
Data Models for Contact Info
- class rattail.db.model.contact.ContactMixin[source]¶
Mixin which provides some useful methods for “contact” models, i.e. those which can play “parent” to email, phone and address records.
- first_email(invalid=False, **kwargs)[source]¶
Return the first available email record for the contact.
- Parameters:
invalid¶ – If true, then this may return an email marked invalid; if false then only valid email will be returned.
- first_email_address(invalid=False, **kwargs)[source]¶
Return the first available email address for the contact.
- set_primary_address(address, flush=True)[source]¶
Will re-arrange the contact’s address records as needed to ensure that the given
address
record is “primary” - i.e. first in the list.
- class rattail.db.model.contact.EmailAddress(**kwargs)[source]¶
Represents an email address associated with a contactable entity.
- invalid¶
Flag indicating whether the email address is known to be invalid. Defaults to NULL, meaning the validity is “not known”.
- class rattail.db.model.contact.MailingAddress(**kwargs)[source]¶
Represents a physical / mailing address associated with a contactable entity.
- class rattail.db.model.contact.PhoneNumber(**kwargs)[source]¶
Represents a phone (or fax) number associated with a contactable entity.
Todo
Geez a lot of work left here…