Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions course/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,7 @@ def view_start_flow(pctx: CoursePageContext, flow_id: str) -> http.HttpResponse:
"grade_aggregation_strategy_descr": grade_aggregation_strategy_descr,
"start_may_decrease_grade": start_may_decrease_grade,
"past_sessions_and_properties": past_sessions_and_properties,
"course": fctx.course,
},
allow_instant_flow_requests=False)

Expand Down
4 changes: 2 additions & 2 deletions course/templates/course/flow-start.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ <h3 class="start-well-title">{% trans "Past sessions" %}</h3>
{% endif %}
{% if new_session_grading_rule.due %}
<li>
{% blocktrans trimmed with due=new_session_grading_rule.due %}
Your session will be due on <b>{{ due }}</b>.
{% blocktrans trimmed with due=new_session_grading_rule.due|eval_datespec:course %}
Your session will be due on <b>{{ due}}</b>.
{% endblocktrans %}
</li>
{% endif %}
Expand Down
30 changes: 21 additions & 9 deletions course/templatetags/coursetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
THE SOFTWARE.
"""

from typing import TYPE_CHECKING

from django.template import Library, Node, TemplateSyntaxError
from django.utils import translation


if TYPE_CHECKING:
from course.datespec import Datespec
from course.models import Course, Participation


register = Library()


Expand Down Expand Up @@ -73,8 +80,8 @@ def do_get_current_js_lang_name(parser, token):

# {{{ filter for participation.has_permission()

@register.filter(name="has_permission")
def has_permission(participation, arg):
@register.filter
def has_permission(participation: Participation, arg: str):
"""
Check if a participation instance has specific permission.
:param participation: a :class:`participation:` instance
Expand All @@ -98,7 +105,7 @@ def has_permission(participation, arg):
# }}}


@register.filter(name="may_set_fake_time")
@register.filter
def may_set_fake_time(user):
"""
Check if a user may set fake time.
Expand All @@ -109,7 +116,7 @@ def may_set_fake_time(user):
return msf(user)


@register.filter(name="may_set_pretend_facility")
@register.filter
def may_set_pretend_facility(user):
"""
Check if a user may set pretend_facility
Expand All @@ -120,22 +127,27 @@ def may_set_pretend_facility(user):
return mspf(user)


@register.filter(name="commit_message_as_html")
@register.filter
def commit_message_as_html(commit_sha, repo):
from course.versioning import _get_commit_message_as_html
return _get_commit_message_as_html(repo, commit_sha)


@register.filter(name="get_item")
@register.filter
def get_item(dictionary, key):
return dictionary.get(key, None)


@register.filter(name="get_item_or_key")
@register.filter
def get_item_or_key(dictionary, key):
return dictionary.get(key, key)


@register.filter(name="startswith")
def startswith(s, arg):
@register.filter
def startswith(s: str, arg: str):
return s.startswith(arg)


@register.filter
def eval_datespec(dspec: Datespec, course: Course):
return dspec.eval(course)