Merge pull request #1151 from migonzalvar/fix/export

Fix project export done email
remotes/origin/3.4.0rc
Miguel Gonzalez 2018-07-16 07:27:54 +02:00 committed by GitHub
commit 989fcfe466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 7 deletions

View File

@ -16,7 +16,7 @@
# 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/>.
from datetime import datetime
import datetime as dt
from django_jinja import library
from django_sites import get_by_id as get_site_by_id
@ -34,7 +34,7 @@ def resolve(type, *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')
@library.filter(name="parse_and_format_date")
def parse_and_format_date(value, *args):
date_value = dt.datetime.strptime(value, '%Y-%m-%d')
return date_value.strftime('%d %b %Y')

View File

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

View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Miguel González <migonzalvar@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# 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/>.
import pytest
from django.core.management import call_command
from .. import factories as f
@pytest.mark.django_db
def test_emails():
# Membership invitation
m = f.MembershipFactory.create()
m.user = None
m.save()
# Regular membership
f.MembershipFactory.create()
# f.UserFactory.create()
call_command('test_emails', 'none@example.test')