Views - DDMAL/CantusDB GitHub Wiki

Many of CantusDB's pages are rendered using a view, which provides data with which to populate the template associated with the page. For those pages that do not have an associated view, refer to the documentation on flat pages.

main_app

Views related to main_app models, as well as those related to User, are defined in /main_app/views/ (view directory).

Century views

Views related to Centuries are defined in /main_app/views/century.py (view file).

CenturyDetailView

The Century Detail View (code) displays a list of Sources belonging to a particular Century.

It can be accessed by clicking on the "Century" link in the right sidebar of the Source Detail View, or directly at /century/<id> (example: http://206.12.93.196/century/3841).

It uses the chant_detail.html template (code).

Chant views

Views related to Chants are defined in /main_app/views/chant.py (view file).

ChantDetailView

The Chant Detail View (code) displays information on a single Chant object.

It can be accessed at /chant/<id> (example: http://206.12.93.196/chant/243157).

It uses the chant_detail.html template (code).

ChantListView

The Chant List View (code) displays a list of Chant objects from a specified Source, which can be filtered by Feast, Genre, folio and/or text using optional GET parameters.

It can be accessed via /chants/?source=<id>, followed by any combination of &feast=<id>, &genre=<id>, &folio=<folio> and &search_text=<text> (examples: http://206.12.93.196/chants/?source=123610, http://206.12.93.196/chants/?source=123610&feast=1975&search_text=audivi&genre=162).

It uses the chant_list.html template (code).

ChantByCantusIDView

The Chant by Cantus ID View (code) displays a list of all Chants with a given Cantus ID.

It can be accessed via /id/<cantus ID> (example: http://206.12.93.196/id/007957).

It uses the chant_seq_by_cantus_id.html template (code).

ChantSearchView

The Chant Search View (code) displays a list of Chants matching the provided search terms.

It can be accessed via /chant-search/ (example: http://206.12.93.196/chant-search/).

It uses the chant_search.html template (code), which is also used by the chant search manuscript view.

MelodySearchView

The Melody Search View (code) allows users to search for chants beginning with or containing a specified melody.

It can be accessed via /melody/ (example: http://206.12.93.196/melody/).

It uses the melody_search.html template (code).

ChantSearchMSView

The Chant Search Manuscript View (code) searches for chants in a specified source.

It can be accessed via /chant-search-ms/<source id> (example: http://206.12.93.196/chant-search-ms/123610).

It uses the chant_search.html template (code), which is also used by the Chant Search View.

ChantCreateView

The Chant Create View (code) allows users to create new chants in a specified source.

It can be accessed via /chant-create/<source id> (example: http://206.12.93.196/chant-create/699578).

It uses the chant_create.html template (code).

The chant create view has a number of functions defined within it, which serve to streamline the user experience of creating chants:

  • get_initial() gathers information on the chant that was most recently created in that source, allowing the folio, feast, sequence_number, and image_link fields to be pre-populated upon page load.
  • get_suggested_chants() takes the chant that was most recently created in the source, and gathers a list of Cantus IDs of chants that often follow that chant in other sources. These Cantus IDs, along with sample texts, are then displayed in the right sidebar of the page - if the user clicks on the button beneath one of these Cantus IDs, it populates many of the fields on the page using data taken from Cantus Index.
  • get_suggested_feasts() takes the feast of the chant that was most recently created in the source, and gathers a list of feasts that tend to follow that feast in other manuscripts. This allows a list of commonly-following feasts to be displayed as links beneath the "Feast:" selector, which populate that selector when clicked.

ChantDeleteView

The Chant Delete View (code) was created for testing purposes, providing detail on when a chant object was created and last modified, and prompting the user to confirm they wish to delete the chant.

It can be accessed by replacing the /chant/ in the url of any chant detail page with /chant-delete/ (e.g. http://206.12.93.196/chant/699579 > http://206.12.93.196/chant-delete/699579).

It uses the chant_confirm_delete.html template (code).

CISearchView

The Cantus Index Search View (code) displays data from Cantus Index on all chants containing a specified string. It is not meant to be accessed directly, rather, it is meant to be launched by clicking the "Search ID" button in the "Input Tool" sidebar on the chant create view, where it is used to populate the "Manuscript Reading Full Text" field.

If you need to access it directly, it can be reached via /ci-search/<string> (example: http://206.12.93.196/ci-search/puer).

It uses the ci_search.html template (code).

ChantIndexView

The Chant Index View (code) displays a table listing all chants in a specified source.

It can be accessed via /index/?source=<id> (example: http://206.12.93.196/index/?source=123610).

It uses the chant_index.html template (code).

SourceEditChantsView

The Source Edit Chants View is the main view for editing chants.

It can be accessed via /edit-chants/<source id> (example: http://206.12.93.196/edit-chants/699578). Optional ?folio=<folio> and ?feast=<feast ID> query strings can be appended to the URL, which filter results from the source by feast and folio respectively. To actively edit a chant, a ?pk=<chant ID> query string is included in the URL; in order for this to work, either a feast or a folio must be specified among the query parameters.

It uses the chant_edit.html template (code).

This view used to be called (confusingly, as there was also a ChantEditView in the past) ChantEditVolpianoView. It is now called the Source Edit Chants View: the main part of its URL is a Source ID, and it allows editing of all chants within a source. It lives in views/chants.py because it is the primary view for editing chants.

ChantProofreadView

The Chant Proofread View is similar to the Source Edit Chants View - the main difference is that in addition to many of the fields on the Source Edit Chants View, there are checkboxes to change the proofread status of several fields. URLs are formed in the same manner as the Source Edit Chants View, substituting /proofread-chant for /edit-chants.

It uses the chant_proofread.html template (code).

ChantEditSyllabificationView

The Chant Edit Syllabification View is used to edit the syllabified text of a chant, so that it displays properly when aligned with the chant's volpiano.

It is usually accessed via a link at the bottom of the Source Edit Chants View. It can be accessed via /edit-syllabification/<chant id> (example: http://206.12.93.196/edit-syllabification/702098).

It uses the chant_syllabification_edit.html template (code).

Feast views

Views related to Feasts are defined in /main_app/views/feast.py (view file).

FeastDetailView

The Feast Detail View (code) displays information on a single Feast object. It also displays a list of chants associated with the feast, and a list of sources that include chants for that feast.

It can be accessed at /feast/<id> (example: http://206.12.93.196/feast/2311).

It uses the feast_detail.html template (code).

FeastListView

The Feast List View (code) displays a filterable list of all Feasts in the database.

It can be accessed at /feasts/ (example: http://206.12.93.196/feasts). Filtering is specified by appending various query parameters to the url.

It uses the feast_list.html template (code).

Genre views

Views related to Genres are defined in /main_app/views/genre.py (view file).

GenreDetailView

The Genre Detail View (code) displays information on a single Genre object. It also displays a list of Cantus IDs associated with that genre, along with a representative Chant with that Cantus ID.

It can be accessed at /genre/<id> (example: http://206.12.93.196/genre/122).

It uses the genre_detail.html template (code).

GenreListView

The Genre List View (code) displays a filterable list of all Genres in the database.

It can be accessed at /genres/ (example: http://206.12.93.196/genres). Filtering is specified by appending a ?mass_office query parameter to the url.

It uses the genre_list template (code).

Indexer views

Views related to Indexers are defined in /main_app/views/indexer.py (view file).

IndexerDetailView

IndexerListView

Notation views

Notation only has a single view: the Notation Detail View. It is defined in /main_app/views/notation.py (view file).

NotationDetailView

The Notation Detail View displays a list of Sources using that Notation.

It can be accessed at /notation/<id> (example: http://206.12.93.196/notation/3895).

It uses the notation_detail.html template (code).

Office views

Views related to Offices are defined in /main_app/views/office.py (view file).

OfficeDetailView

The Office Detail View (code) displays information on a single Office object. Modelled after OldCantus, it is very spare.

It can be accessed at /office/<id> (example: http://206.12.93.196/office/4153).

It uses the office_detail.html template (code).

OfficeListView

The Office List View (code) displays a list of all Offices in the database.

It can be accessed at /offices/ (example: http://206.12.93.196/offices/).

It uses the office_list.html template (code).

Provenance views

Provenance only has a single view: the Provenance Detail View. It is defined in /main_app/views/provenance.py (view file).

ProvenanceDetailView

The Provenance Detail View displays a list of Sources of a certain Provenance.

It can be accessed at /provenance/<id> (example: http://206.12.93.196/provenance/3622).

It uses the provenance_detail.html template (code).

Sequence views

Views related to Sequences are defined in /main_app/views/sequence.py (view file).

SequenceDetailView

SequenceListView

SequenceEditView

Source views

Views related to Sources are defined in /main_app/views/source.py (view file).

SourceDetailView

SourceListView

SourceCreateView

SourceEditView

Source Edit Chants View

The Source Edit Chants View is the primary view for editing chants. For more information, see SourceEditChantsView above.

User views

User views are defined in /main_app/views/user.py (view file).

UserDetailView

UserSourceListView

CustomLogoutView

UserListView

CustomLoginView

Other views

Other views are defined in /main_app/views/views.py (view file).

redirect_node_url

The Node Redirect view exists for backwards compatibility with OldCantus, where Chant, Source, Sequence, Article and Indexer pages could be accessed by a /node/<pk> URL in addition to their /chant/<pk> etc. URLs. In OldCantus, all these items were stored in the same table, so they were all guaranteed to have unique primary keys. The Node Redirect view in NewCantus checks whether an object with a matching PK exists in any of our Chant/Source/etc. pages, and if it finds one, redirects users to the proper Chant/Source/etc. page. It only works for items that were originally created in OldCantus - this redirect does not work for items originally created in NewCantus.

For discussion about this view and how best to implement it, refer to Issue 563.

Items Count Page

Contact Us Page

Change Password Page

csv_export API

See APIs > CantusDB APIs > csv_export.

json_node_export API

See APIs > CantusDB APIs > json_node_export.

json_sources_export API

See APIs > CantusDB APIs > json_sources_export.

json_nextchants API

See APIs > CantusDB APIs > json_nextchants.

articles

Views related to Articles are defined in /articles/views.py (view file).

ArticleDetailView

ArticleListView

users

See User views above.

⚠️ **GitHub.com Fallback** ⚠️