Merge pull request #1092 from dangarbar/ft/due-date-activity

Ft/due date activity
remotes/origin/3.4.0rc
Alex Hermida 2018-04-13 23:38:09 +02:00 committed by GitHub
commit 2284ec6b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 6 deletions

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from django_jinja import library from django_jinja import library
from django_sites import get_by_id as get_site_by_id 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 "" scheme = site.scheme and "{0}:".format(site.scheme) or ""
url = urls[type].format(*args) url = urls[type].format(*args)
return url_tmpl.format(scheme=scheme, domain=site.domain, url=url) 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')

View File

@ -357,8 +357,7 @@ def userstory_freezer(us) -> dict:
"blocked_note_html": mdrender(us.project, us.blocked_note), "blocked_note_html": mdrender(us.project, us.blocked_note),
"custom_attributes": extract_user_story_custom_attributes(us), "custom_attributes": extract_user_story_custom_attributes(us),
"tribe_gig": us.tribe_gig, "tribe_gig": us.tribe_gig,
"due_date": str(us.due_date), "due_date": str(us.due_date) if us.due_date else None
"due_date_reason": str(us.due_date_reason),
} }
return snapshot return snapshot
@ -383,8 +382,7 @@ def issue_freezer(issue) -> dict:
"blocked_note": issue.blocked_note, "blocked_note": issue.blocked_note,
"blocked_note_html": mdrender(issue.project, issue.blocked_note), "blocked_note_html": mdrender(issue.project, issue.blocked_note),
"custom_attributes": extract_issue_custom_attributes(issue), "custom_attributes": extract_issue_custom_attributes(issue),
"due_date": str(issue.due_date), "due_date": str(issue.due_date) if issue.due_date else None
"due_date_reason": str(issue.due_date_reason),
} }
return snapshot return snapshot
@ -410,8 +408,7 @@ def task_freezer(task) -> dict:
"blocked_note": task.blocked_note, "blocked_note": task.blocked_note,
"blocked_note_html": mdrender(task.project, task.blocked_note), "blocked_note_html": mdrender(task.project, task.blocked_note),
"custom_attributes": extract_task_custom_attributes(task), "custom_attributes": extract_task_custom_attributes(task),
"due_date": str(task.due_date), "due_date": str(task.due_date) if task.due_date else None
"due_date_reason": str(task.due_date_reason),
} }
return snapshot return snapshot

View File

@ -149,6 +149,33 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{# ASSIGNED TO #}
{% elif field_name == "due_date" %}
<tr>
<td valign="middle" rowspan="2" class="update-row-name">
<h3>{{ verbose_name(obj_class, field_name) }}</h3>
</td>
<td valign="top" class="update-row-from">
{% if values.0 != None and values.0 != "" %}
<span>{{ _("from") }}</span><br>
<strong>{{ values.0|date }}</strong>
{% else %}
<span>{{ _("from") }}</span><br>
<strong>{{ _("Not set") }}</strong>
{% endif %}
</td>
</tr>
<tr>
<td valign="top">
{% if values.1 != None and values.1 != "" %}
<span>{{ _("to") }}</span><br>
<strong>{{ values.1|date }}</strong>
{% else %}
<span>{{ _("to") }}</span><br>
<strong>{{ _("Not set") }}</strong>
{% endif %}
</td>
</tr>
{# * #} {# * #}
{% else %} {% else %}
<tr> <tr>