Chant model - DDMAL/CantusDB GitHub Wiki
Chant (code) is a model in the main_app app. It is defined in /main_app/models/chant.py (view file).
Chant inherits from the abstract BaseChant model: both the Chant model and the Sequence model must have the same fields. The reason is that we want both chants and sequences to appear in chant-search results and thus have to do a union operation on two querysets from the two models. Django allows us to do that only if they have the exact same fields. Thus, all fields, properties and attributes for both Chants and Sequences are declared in BaseChant in order to keep the two models' fields harmonized, even when only one of the two models uses a particular field.
Views
Chant has many views:
- Chant Detail View
- Chant List View
- Chant by Cantus ID View
- Chant by Cantus ID View
- Chant Search View
- Melody Search View
- Chant by Cantus ID View
- Chant Search Manuscript View
- Chant Create View
- Chant Delete View
- Cantus Index Search View
- Chant Index View
- Chant Edit Volpiano View
- Chant Proofread View
- Chant Edit Syllabification View
Fields
- inherited from BaseChant:
visible_statustitleincipitsiglumfoliosequencesequence_numbergenrerubricsanalecta_hymnicaindexing_notesdatecol1col2col3ah_volumesourcecantus_idimage_linkjson_infomarginaliaofficepositionfeastmodedifferentiadifferentia_idfinalisextrachant_rangeaddendummanuscript_full_text_std_spellingmanuscript_full_text_std_proofreadmanuscript_full_textmanuscript_full_text_proofreadmanuscript_syllabized_full_textvolpianovolpiano_proofreadvolpiano_notesvolpiano_intervalscao_concordancesproofread_bymelody_idsearch_vectorcontent_structurenext_chantis_last_chant_in_feastdate_createddate_updatedcreated_bylast_updated_by
Methods
get_ci_url(): i.e. "get Cantus Index url". Returns a link (as a string) to the Cantus Index page that corresponds to the chant's Cantus ID.index_components(): gathers infomation on a chant/sequence'sincipit,full_text,full_text_std_spelling,source,genre,feastandoffice, packaging it into a dictionary. It is used in theupdate_chant_search_vector()function insignals.py(code).related_chants_by_cantus_id(): Returns a Queryset of all chants in the database with the same Cantus ID as the current chant.get_next_chant(): Returns the chant that immediately follows the current chant in its manuscript, based on the chants' Source,folioandsequence_number. Whereas this method used to be used to calculate several in the operation of CantusDB on the fly, these views/functions have been refactored to use chants'next_chantmethod so as to run more quickly. Now,get_next_chant()is mostly used to populate this field, within thepopulate_next_chant_fields(code) management command- inherited from BaseChant:
save()display_name(property)get_absolute_url()get_verbose_name()get_verbose_name_plural()get_fields_and_properties()