Part¶
-
class
database.models.
Part
(*args, **kwargs)¶ Bases:
database.mixins.file_and_source_info_mixin.FileAndSourceInfoMixin
,database.mixins.contribution_info_mixin.ContributionInfoMixin
,database.models.custom_base_model.CustomBaseModel
A single voice or instrument in a Section of a Musical Work.
Purely abstract entity that can manifest in differing versions. Must belong to one and only one Section.
-
written_for
¶ models.ForeignKey – Reference to the Instrument for which this Part was written
-
s.
section
¶ models.ForeignKey – Reference to the Section to which this Part belongs
-
sources
¶ models.ManyToOneRel – References to Sources that instantiate this Part
-
contributions
¶ models.ManyToOneRel – References to Contributions objects that describe the contributions (and thus the contributors) of this Part
See also
database.models.CustomBaseModel
,database.models.Section
,database.models.Contribution
,database.models.Instrument
Attributes Summary
contributions
Accessor to the related objects manager on the reverse side of a many-to-one relation. id
A wrapper for a deferred-loading field. objects
section
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation. section_id
A wrapper for a deferred-loading field. source_instantiations
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation. written_for
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation. written_for_id
A wrapper for a deferred-loading field. Methods Summary
clean
()Ensure that only Sections with no children have parts get_next_by_date_created
(*[, field, is_next])get_next_by_date_updated
(*[, field, is_next])get_previous_by_date_created
(*[, field, is_next])get_previous_by_date_updated
(*[, field, is_next])musical_work
()Get the MusicalWork to which this Part belongs. Attributes Documentation
-
contributions
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.children
is aReverseManyToOneDescriptor
instance.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.
-
objects
= <django.db.models.manager.Manager object>¶
-
section
¶ 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.parent
is aForwardManyToOneDescriptor
instance.
-
section_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_instantiations
¶ 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.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
written_for
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.parent
is aForwardManyToOneDescriptor
instance.
-
written_for_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Methods Documentation
-
clean
() → None¶ Ensure that only Sections with no children have parts
Raises: ValidationError
– If the Section being validated has child sections and also has Parts
-
get_next_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
-
get_next_by_date_updated
(*, field=<django.db.models.fields.DateTimeField: date_updated>, is_next=True, **kwargs)¶
-
get_previous_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
-
get_previous_by_date_updated
(*, field=<django.db.models.fields.DateTimeField: date_updated>, is_next=False, **kwargs)¶
-
musical_work
()¶ Get the MusicalWork to which this Part belongs.
-