Citation Views and Rendering

For a full listing of the available views, see the urls.py file.

Standard types of views available:
  • List views: Citations, Parties, Institutions, FundingStreams

  • Specific Record views: Citation, Party, Institution, FundingStreams

  • API List views: Citations, Parties, Institutions, FundingStreams

  • Specific API views: Citation, Party

  • Create/Edit UI view: Citation (able to create new instances of all the above)

  • Delete view: Citation (No other records able to be deleted via UI currently.)

  • Delete API views: Citations, Parties, Institutions, FundingStreams

Miscellaneous Other Views:
  • Reviewer Request: Allows users to request access to review records.

Render functions listed below may perform changes to the content rendered to the HTML view for a better user experience. This includes:
  • Adding links to the abstract paragraph based on references in the citation

  • Linking to the rights/licence info from the RIGHTS_MAP

  • Rendering the references with linked DOIs and bold titles.

  • Rendering the Cite As option from the DOI and available info

  • Adding the STAC Code Snippet if available.

Permissions apply to all create/update/delete views including for the API (PUT/POST/DELETE methods), where a user/token provided must have both the add_citations and edit_<institution> permissions to edit an existing record, or just the add_citations permission to create new records.

citations.views.create_new_permission(user, institution_id: str)[source]

Create a new permission type based on the newly added institution.

The user who created the new institution will automatically be given access to that new permission. This permission allows editing based on the institution_id of the record.

Creating a new record with an existing institution will only be allowed if the user already has permission for that institution.

citations.views.get_citable_party(party: Parties)[source]

Get representation of a party in the Cite As field.

This is also done on rendering, to just assemble these fields in the correct manner.

citations.views.render_code_snippet(citation_data: dict) str | None[source]

Get code snippet on rendering.

The code snippet is not saved in the database and is generated on viewing the record.

citations.views.render_cite_as(citation: Citations)[source]

Generate the full Cite As description on loading the page.

This is generated on rendering the citation view.

citations.views.render_abstract(data: dict) str[source]

Apply formatting in the form of links to references identified in the abstract

This occurs on rendering the citation view.

citations.views.render_rights(data: dict) str[source]

Generate the Rights section with appropriate labelling and linking.

This is generated on rendering the citation view, assuming the Rights section is not empty.

citations.views.render_reference_html(ref: dict) dict[source]

Apply bold to the reference title and link to the DOI.

This occurs on rendering the citation view.

citations.views.fullname(party: dict) str[source]

Display the fullname of a party based on if the middle name is blank or not

Fuzzy search for a term within the queryset.

This also allows ordering of search results and filtering on versions.

citations.views.filter_versions(queryset)[source]

Find only the latest version of every citation record.

Will find the titles of all records in the queryset and filter out the non-latest version records.

citations.views.check_publish_ok(request, data: dict) tuple[source]

Send a message to the user (UI) if a DOI minting event is unsuccessful.

Repeat the checks done at publication such that a message can be generated to present to the user.

class citations.views.GenericRenderedView(**kwargs)[source]

Generic processing for all UI views, including configuring CEDA branding templates

get_context_data(**kwargs)[source]

Adds the CEDA branding or generic base for rendering.

get_instance(pk)[source]

Handle 404 on getting an instance of a model

class citations.views.PaginatedListView(**kwargs)[source]

Pagination for all UI List views using HTMX

get_context_data(page_obj, page_number: int = 1, search_term=None, count=None, **kwargs)[source]

Handle pagination context including page number and search term if provided.

Obtain the search term and apply a deep ‘fuzzy’ search to all instances of the model.

get(request, *args, **kwargs)[source]

Get list view with filtering and pagination

adjust_for_UI_render(queryset) list[source]

Convert queryset to JSON representations

class citations.views.GenericAPIView(**kwargs)[source]

Generic Method Additions to the API View

get_permissions()[source]

Instantiates and returns the list of permissions that this view requires.

initialize_request(request, *args, **kwargs)[source]

Decode Information Given to POST requests

class citations.views.SpecificAPIView(**kwargs)[source]

Specific View Methods

get_permissions()[source]

Instantiates and returns the list of permissions that this view requires.

initialize_request(request, *args, **kwargs)[source]

Decode Information Given to POST requests

class citations.views.PartiesView(**kwargs)[source]
model

alias of Parties

serializer_class

alias of PartiesSerializer

class citations.views.InstitutionsView(**kwargs)[source]
model

alias of Institutions

serializer_class

alias of InstitutionsSerializer

class citations.views.FundingStreamsView(**kwargs)[source]
model

alias of FundingStreams

serializer_class

alias of FundingStreamsSerializer

adjust_for_UI_render(queryset) list[source]

Convert queryset to JSON representations

class citations.views.CitationsView(**kwargs)[source]
model

alias of Citations

serializer_class

alias of CitationsSerializer

get_context_data(*args, **kwargs)[source]

Handle pagination context including page number and search term if provided.

Obtain the search term and apply a deep ‘fuzzy’ search to all instances of the model.

adjust_for_UI_render(queryset) list[source]

Convert queryset to JSON representations

class citations.views.CitationView(**kwargs)[source]
get_context_data(title, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.InstitutionView(**kwargs)[source]
model

alias of Institutions

serializer_class

alias of InstitutionsSerializer

get_context_data(pk, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.FundingStreamView(**kwargs)[source]
model

alias of FundingStreams

serializer_class

alias of FundingStreamsSerializer

get_context_data(pk, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.PartyView(**kwargs)[source]
get_context_data(pk, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.InstitutionAPIView(**kwargs)[source]

List all institutions

model

alias of Institutions

serializer_class

alias of InstitutionsSerializer

class citations.views.SpecificPartyAPIView(**kwargs)[source]

Action requests related to Specific Party

model

alias of Parties

serializer_class

alias of PartiesSerializer

class citations.views.PartyAPIView(**kwargs)[source]

List all parties.

model

alias of Parties

serializer_class

alias of PartiesSerializer

class citations.views.FundingStreamAPIView(**kwargs)[source]

List all funding streams.

model

alias of FundingStreams

serializer_class

alias of FundingStreamsSerializer

class citations.views.CitationAPIView(**kwargs)[source]

List all funding streams.

model

alias of Citations

serializer_class

alias of CitationsSerializer

class citations.views.SpecificCitationAPIView(**kwargs)[source]

List all funding streams.

model

alias of Citations

serializer_class

alias of CitationsSerializer

class citations.views.CitationFormMixin(**kwargs)[source]
model

alias of Citations

serializer_class

alias of CitationsSerializer

dispatch(request, *args, **kwargs)[source]

Setup for form view

get_context_data(**kwargs)[source]

Adds the CEDA branding or generic base for rendering.

clean_formset_data(formset: dict, serializer, model, allow_update: bool = False) list[source]

Clean data from a formset and determine if updates are required

class citations.views.NewCitationFormView(**kwargs)[source]
form_class

alias of NewCitationForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_initial()[source]

Return the initial data to use for forms on this view.

get_context_data(**kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.EditCitationFormView(**kwargs)[source]
form_class

alias of EditCitationForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_initial()[source]

Return the initial data to use for forms on this view.

get_context_data(pk: str, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.ConfirmDeleteCitationView(**kwargs)[source]
model

alias of Citations

serializer_class

alias of CitationsSerializer

get_context_data(pk, **kwargs)[source]

Adds the CEDA branding or generic base for rendering.

class citations.views.ReviewerRequestView(**kwargs)[source]
form_class

alias of InstitutionIdForm

get_context_data(**kwargs)[source]

Adds the CEDA branding or generic base for rendering.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.