]> git.parisson.com Git - mezzo.git/commitdiff
Add project links, fix no project dates
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 23 Sep 2016 09:18:50 +0000 (11:18 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 23 Sep 2016 09:18:50 +0000 (11:18 +0200)
app/organization/projects/models.py
app/templates/pages/projecttopicpage.html

index c39e8230026292bbad7ce42ca04424b0e0b3e86b..c5d1b63eefa452c07dd971dac6acbfedc4686e1e 100644 (file)
@@ -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):
index 4bbae4dcda96f05dc44474d9d4059e7022c8bef3..33ff146b3b5d335eea606da0357184c11c4dbe62 100644 (file)
         {{ sub_topic }}<br>
           {% trans "European and national projects" %}<br>
           {% for project in sub_topic.projects.all|get_type:"external project" %}
-            {{ project }}<br>
+            <a href="{% url 'organization-project-detail' project.slug %}">{{ project }}</a><br>
           {% endfor %}
           {% trans "Internal projects" %}<br>
           {% for project in sub_topic.projects.all|get_type:"internal project" %}
-            {{ project }}<br>
+            <a href="{% url 'organization-project-detail' project.slug %}">{{ project }}</a><br>
           {% endfor %}
       {% endfor %}
     {% endwith %}