From: Guillaume Pellerin Date: Fri, 23 Sep 2016 09:18:50 +0000 (+0200) Subject: Add project links, fix no project dates X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=59df93a3177682102881a638324f9655c3356598;p=mezzo.git Add project links, fix no project dates --- diff --git a/app/organization/projects/models.py b/app/organization/projects/models.py index c39e8230..c5d1b63e 100644 --- a/app/organization/projects/models.py +++ b/app/organization/projects/models.py @@ -38,12 +38,15 @@ class Project(Displayable, Period, RichText): return reverse("organization-project-detail", kwargs={"slug": self.slug}) def project_status(self): - if datetime.date.today() >= self.date_from and datetime.date.today() <= self.date_to: - return _('in progress') - elif datetime.date.today() < self.date_from and datetime.date.today() < self.date_to: + if self.date_from and self.date_to: + if datetime.date.today() >= self.date_from and datetime.date.today() <= self.date_to: + return _('in progress') + elif datetime.date.today() < self.date_from and datetime.date.today() < self.date_to: + return _('pending') + elif datetime.date.today() > self.date_to and datetime.date.today() > self.date_to: + return _('completed') + else: return _('pending') - elif datetime.date.today() > self.date_to and datetime.date.today() > self.date_to: - return _('completed') class ProjectTopic(Named): diff --git a/app/templates/pages/projecttopicpage.html b/app/templates/pages/projecttopicpage.html index 4bbae4dc..33ff146b 100644 --- a/app/templates/pages/projecttopicpage.html +++ b/app/templates/pages/projecttopicpage.html @@ -48,11 +48,11 @@ {{ sub_topic }}
{% trans "European and national projects" %}
{% for project in sub_topic.projects.all|get_type:"external project" %} - {{ project }}
+ {{ project }}
{% endfor %} {% trans "Internal projects" %}
{% for project in sub_topic.projects.all|get_type:"internal project" %} - {{ project }}
+ {{ project }}
{% endfor %} {% endfor %} {% endwith %}