The devilry_core_tags template library

devilry.apps.core.templatetags.devilry_core_tags.devilry_escape_html(html)

Escape all html in the given html.

devilry.apps.core.templatetags.devilry_core_tags.devilry_isoformat_datetime(datetimeobject)

Isoformat the given datetimeobject as YYYY-MM-DD hh:mm.

devilry.apps.core.templatetags.devilry_core_tags.devilry_single_candidate_long_displayname(assignment, candidate, devilryrole)

Returns the candidate wrapped in HTML formatting tags perfect for showing the user inline in a verbose manner.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_single_candidate_short_displayname(assignment, candidate, devilryrole)

Returns the candidate wrapped in HTML formatting tags perfect for showing the user inline in a non-verbose manner.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_single_examiner_long_displayname(assignment, examiner, devilryrole)

Returns the examiner wrapped in HTML formatting tags perfect for showing the user inline in a verbose manner.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_single_examiner_long_displayname_plain(assignment, examiner, devilryrole)

Same as devilry_single_examiner_long_displayname() but returns the examiner without styling.

devilry.apps.core.templatetags.devilry_core_tags.devilry_single_examiner_short_displayname(assignment, examiner, devilryrole)

Returns the examiner wrapped in HTML formatting tags perfect for showing the user inline in a non-verbose manner.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_multiple_candidates_long_displayname(assignment, candidates, devilryrole)

Returns the candidates wrapped in HTML formatting tags perfect for showing the candidates inline in a verbose manner.

Typically used for showing all the candidates in an devilry.apps.core.models_group.AssignmentGroup.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_multiple_candidates_short_displayname(assignment, candidates, devilryrole)

Returns the candidates wrapped in HTML formatting tags perfect for showing the candidates inline in a non-verbose manner.

Typically used for showing all the candidates in an devilry.apps.core.models_group.AssignmentGroup.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_multiple_examiners_long_displayname(assignment, examiners, devilryrole)

Returns the examiners wrapped in HTML formatting tags perfect for showing the examiners inline in a verbose manner.

Typically used for showing all the examiners in an devilry.apps.core.models_group.AssignmentGroup.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_multiple_examiners_short_displayname(assignment, examiners, devilryrole)

Returns the examiners wrapped in HTML formatting tags perfect for showing the examiners inline in a non-verbose manner.

Typically used for showing all the examiners in an devilry.apps.core.models_group.AssignmentGroup.

Handles anonymization based on assignment.anonymizationmode and devilryrole.

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_groupstatus(group)

Get the status for the given AssignmentGroup.

The output is one of the following texts wrapped in some <span> elements with appropriate css classes:

  • "waiting for feedback"
  • "waiting for deliveries"
  • "corrected"

Note

We normally do not show the corrected status, but instead show the grade using devilry_grade_full(), at least in listings and other places where space is premium.

Assumes the AssignmentGroup queryset is annotated with:

  • annotate_with_is_waiting_for_feedback()
  • annotate_with_is_waiting_for_deliveries()
  • annotate_with_is_corrected()
Parameters:group – A An devilry.apps.core.models.AssignmentGroup object.
devilry.apps.core.templatetags.devilry_core_tags.devilry_grade_short(assignment, points)

Renders a grade as in its shortest form - no information about passed or failed, only the grade text (E.g.: “passed”, “8/10”, “A”).

Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_grade_full(assignment, points, devilryrole)

Renders a grade as in its long form - including information about passed or failed. Examples:

"passed"
"8/10 (passed)"
"F (failed)"

If the students_can_see_points attribute of the assignment is set to True, students are allowed to see the points behind a grade, so we include the points. Examples:

"passed (10/10)"
"failed (0/10)"
"8/10 (passed)"
"F (failed - 10/100)"
"A (passed - 97/100)"
Parameters:
devilry.apps.core.templatetags.devilry_core_tags.devilry_grade_full_plain(assignment, points, devilryrole)

Renders a grade as in its long form - including information about passed or failed without styling.

devilry.apps.core.templatetags.devilry_core_tags.devilry_comment_summary(group)

Renders a comment summary for the given AssignmentGroup.

Assumes that the AssignmentGroup has been annotated with:

  • annotate_with_number_of_private_groupcomments_from_user().
  • annotate_with_number_of_private_imageannotationcomments_from_user().
Parameters:group – An devilry.apps.core.models.AssignmentGroup object annotated as explained above.
devilry.apps.core.templatetags.devilry_core_tags.devilry_relatedexaminers_on_period_tag(period_tag)

Renders the devilry.apps.core.models.relateduser.RelatedExaminer in a comma separated format if there are any examiners, else it renders NO EXAMINERS.

Parameters:period_tag – a PeriodTag instance.
devilry.apps.core.templatetags.devilry_core_tags.devilry_relatedstudents_on_period_tag(period_tag)

Renders the devilry.apps.core.models.relateduser.RelatedStudent in a comma separated format if there are any students, else it renders NO STUDENTS.

Parameters:period_tag – a PeriodTag object.
devilry.apps.core.templatetags.devilry_core_tags.devilry_relatedusers_on_period_tag(period_tag)

Renders the devilry.apps.core.models.RelatedExaminer and devilry.apps.core.models.RelatedStudent comma separated.

Uses tags devilry_relatedexaminers_on_period_tag() and devilry_relatedstudents_on_period_tag().

Parameters:period_tag – a devilry.apps.core.models.period_tag.PeriodTag object.