Contribution

class database.models.Contribution(*args, **kwargs)

Bases: database.models.custom_base_model.CustomBaseModel

Relate a person that made a Contribution to a Musical Work/Section/Part.

The Contribution Model provides a many-to-many relationship with attributes between one of Musical Work, Section or Part and Person.

Each Contribution relates a Person to exclusively one of MusicalWork, Section or Part.

A Musical Work/Section/Part can have many Contributions, since each of piece of music can have many contributors with different roles i.e. a person composed a piece, two others arranged it, another wrote the lyrics.

Contribution.person : models.ForeignKey
Reference to a Person that made this Contribution to a Musical Work, Section or Part
Contribution.certainty_of_attribution : models.BooleanField
Whether it is certain if this Person made this Contribution
ContributeTo.role : models.CharField
The role that this Person had in contributing. Can be one of: Composer, Arranger, Author of Text, Transcriber, Improviser, Performer
Contribution.date : postgres.fields.DateRangeField
The date in which this Contribution happened
Contribution.location : models.ForeignKey
Reference to the GeographicArea in which this Contribution happened
Contribution.contributed_to_part : models.ForeignKey
Reference to the Part to which this Contribution was made
Contribution.contributed_to_section : models.ForeignKey
Reference to the Section to which this Contribution was made
Contribution.contributed_to_work : models.ForeignKey
Reference to the MusicalWork to which this Contribution was made

Attributes Summary

ROLES
certainty_of_attribution A wrapper for a deferred-loading field.
contributed_to_part Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
contributed_to_part_id A wrapper for a deferred-loading field.
contributed_to_section Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
contributed_to_section_id A wrapper for a deferred-loading field.
contributed_to_work Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
contributed_to_work_id A wrapper for a deferred-loading field.
date
id A wrapper for a deferred-loading field.
location Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
location_id A wrapper for a deferred-loading field.
objects
person Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
person_id A wrapper for a deferred-loading field.
role A wrapper for a deferred-loading field.

Methods Summary

clean() Enforce the integrity of the Contribution relationship.
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])
get_role_display(*[, field])

Attributes Documentation

ROLES = (('COMPOSER', 'Composer'), ('ARRANGER', 'Arranger'), ('AUTHOR', 'Author of Text'), ('TRANSCRIBER', 'Transcriber'), ('IMPROVISER', 'Improviser'), ('PERFORMER', 'Performer'))
certainty_of_attribution

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contributed_to_part

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 a ForwardManyToOneDescriptor instance.

contributed_to_part_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contributed_to_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 a ForwardManyToOneDescriptor instance.

contributed_to_section_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

contributed_to_work

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 a ForwardManyToOneDescriptor instance.

contributed_to_work_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location

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 a ForwardManyToOneDescriptor instance.

location_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>
person

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 a ForwardManyToOneDescriptor instance.

person_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

role

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

Enforce the integrity of the Contribution relationship.

Ensure that at least one and only one of Musical Work/Section/Part is not null.

Raises:ValidationError – If more than one out Musical Work, Section or Part are not null or if all three are null
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)
get_role_display(*, field=<django.db.models.fields.CharField: role>)