diff --git a/taiga/front/templatetags/functions.py b/taiga/front/templatetags/functions.py index db8a6616..2177afe6 100644 --- a/taiga/front/templatetags/functions.py +++ b/taiga/front/templatetags/functions.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from datetime import datetime from django_jinja import library from django_sites import get_by_id as get_site_by_id @@ -31,3 +32,9 @@ def resolve(type, *args): scheme = site.scheme and "{0}:".format(site.scheme) or "" url = urls[type].format(*args) return url_tmpl.format(scheme=scheme, domain=site.domain, url=url) + + +@library.filter(name="date") +def format_date(value, *args): + date_value = datetime.strptime(value, '%Y-%m-%d') + return date_value.strftime('%d %b %Y') diff --git a/taiga/projects/history/freeze_impl.py b/taiga/projects/history/freeze_impl.py index e489a481..a3524b69 100644 --- a/taiga/projects/history/freeze_impl.py +++ b/taiga/projects/history/freeze_impl.py @@ -357,8 +357,7 @@ def userstory_freezer(us) -> dict: "blocked_note_html": mdrender(us.project, us.blocked_note), "custom_attributes": extract_user_story_custom_attributes(us), "tribe_gig": us.tribe_gig, - "due_date": str(us.due_date), - "due_date_reason": str(us.due_date_reason), + "due_date": str(us.due_date) if us.due_date else None } return snapshot @@ -383,8 +382,7 @@ def issue_freezer(issue) -> dict: "blocked_note": issue.blocked_note, "blocked_note_html": mdrender(issue.project, issue.blocked_note), "custom_attributes": extract_issue_custom_attributes(issue), - "due_date": str(issue.due_date), - "due_date_reason": str(issue.due_date_reason), + "due_date": str(issue.due_date) if issue.due_date else None } return snapshot @@ -410,8 +408,7 @@ def task_freezer(task) -> dict: "blocked_note": task.blocked_note, "blocked_note_html": mdrender(task.project, task.blocked_note), "custom_attributes": extract_task_custom_attributes(task), - "due_date": str(task.due_date), - "due_date_reason": str(task.due_date_reason), + "due_date": str(task.due_date) if task.due_date else None } return snapshot diff --git a/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja b/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja index 9d3473e7..ddce4468 100644 --- a/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja +++ b/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja @@ -149,6 +149,33 @@ {% endif %} + {# ASSIGNED TO #} + {% elif field_name == "due_date" %} + + +

{{ verbose_name(obj_class, field_name) }}

+ + + {% if values.0 != None and values.0 != "" %} + {{ _("from") }}
+ {{ values.0|date }} + {% else %} + {{ _("from") }}
+ {{ _("Not set") }} + {% endif %} + + + + + {% if values.1 != None and values.1 != "" %} + {{ _("to") }}
+ {{ values.1|date }} + {% else %} + {{ _("to") }}
+ {{ _("Not set") }} + {% endif %} + + {# * #} {% else %}