lino.mixins¶
This package contains model mixins, some of which are heavily used by applications and the Lino Extensions Library. But none of them is mandatory.
Defines the model mixin |
|
Defines the |
|
Defines the model mixins |
|
See test cases and examples in The Human mixin. |
|
Defines classes related to date ranges. |
|
Defines the |
|
Defines the |
|
This defines the |
(This module's source code is available here.)
Classes
|
Mixin for models that represent somebody who can be contacted by email. |
|
Adds a timestamp field which holds the creation time of every individual database object. |
|
Adds two timestamp fields created and modified. |
|
Adds a a timestamp field which holds the last modification time of every individual database object. |
|
Mixin for models that represent somebody who can be contacted by phone. |
|
Mixin for models that are related to a "project", i.e. to an object of the type given by your lino.core.site.Site.project_model. |
|
-
class
lino.mixins.
Contactable
(*args, **kwargs)¶ Bases:
lino.core.model.Model
Mixin for models that represent somebody who can be contacted by email.
-
get_as_user
()¶ Return the user object representing this contactable.
-
-
class
lino.mixins.
Phonable
(*args, **kwargs)¶ Bases:
lino.core.model.Model
Mixin for models that represent somebody who can be contacted by phone.
-
class
lino.mixins.
Modified
(*args, **kwargs)¶ Bases:
lino.core.model.Model
Adds a a timestamp field which holds the last modification time of every individual database object.
-
modified
¶ The time when this database object was last modified.
-
-
class
lino.mixins.
Created
(*args, **kwargs)¶ Bases:
lino.core.model.Model
Adds a timestamp field which holds the creation time of every individual database object.
-
created
¶ The time when this object was created.
Does nut use Django's auto_now and auto_now_add features because their deserialization would be problematic.
-
-
class
lino.mixins.
CreatedModified
(*args, **kwargs)¶ Bases:
lino.mixins.Created
,lino.mixins.Modified
Adds two timestamp fields created and modified.
-
class
lino.mixins.
ProjectRelated
(*args, **kwargs)¶ Bases:
lino.core.model.Model
Mixin for models that are related to a "project", i.e. to an object of the type given by your lino.core.site.Site.project_model.
This adds a field named
project
and related methods.-
project
¶ Pointer to the project to which this object is related.
If the application's
project_model
is empty, theproject
field will be aDummyField
.
-
update_owned_instance
(controllable)¶ When a
project-related
object controls another project-related object, then the controlled automatically inherits the project of its controller.
-