]> git.parisson.com Git - mezzo.git/commitdiff
Add projects and products to team page
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 7 Oct 2016 09:06:15 +0000 (11:06 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 7 Oct 2016 09:06:15 +0000 (11:06 +0200)
app/organization/projects/migrations/0019_auto_20161007_1045.py [new file with mode: 0644]
app/organization/projects/models.py
app/templates/pages/teampage.html

diff --git a/app/organization/projects/migrations/0019_auto_20161007_1045.py b/app/organization/projects/migrations/0019_auto_20161007_1045.py
new file mode 100644 (file)
index 0000000..75035fd
--- /dev/null
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-10-07 08:45
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+def update_project_type(apps, schema_editor):
+    Project = apps.get_model("organization-projects", "Project")
+    for project in Project.objects.all():
+        if project.type == 'external project':
+            project.type = 'external'
+            project.save()
+        if project.type == 'internal project':
+            project.type = 'internal'
+            project.save()
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-projects', '0018_auto_20161005_1424'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='project',
+            name='type',
+            field=models.CharField(choices=[('internal', 'internal'), ('external', 'external')], max_length=128, verbose_name='type'),
+        ),
+        migrations.RunPython(update_project_type),
+    ]
index 1eb9e55a7cdccb1cd361bb5682c2384db7df2c29..5666539b0c3e58b6664f09c65788c9309b1190d9 100644 (file)
@@ -11,8 +11,8 @@ from organization.pages.models import *
 
 
 PROJECT_TYPE_CHOICES = [
-    ('internal project', _('internal project')),
-    ('external project', _('external project')),
+    ('internal', _('internal')),
+    ('external', _('external')),
 ]
 
 class Project(Displayable, Period, RichText):
index 122e5c603737c29345fb98cda0a56b48d2e80f5f..6cea12a8e4651929dd8d6e73e54d001e3c52cec7 100644 (file)
 {% endblock %}
 
 {% block related_project %}
-    {% if page.teampage.team.leader_projects.all or page.teampage.team.patner_projects.all %}
-    <hr>
+    {% if page.teampage.team.leader_projects.all or page.teampage.team.partner_projects.all %}
+        <hr class="mt0" />
+        <h4>{% trans "European and national projects" %}</h4>
+        {% with page.teampage.team.leader_projects.all|get_type:"external" as projects %}
+            {% include 'projects/inc/project_list.html' %}
+        {% endwith %}
+        {% with page.teampage.team.partner_projects.all|get_type:"external" as projects %}
+            {% include 'projects/inc/project_list.html' %}
+        {% endwith %}
+        {% if page.teampage.product_lists.all %}
+            <h4>{% trans "Products" %}</h4>
+            {% for page_product_list in page.teampage.product_lists.all %}
+              {% with page_product_list.list as list %}
+                {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %}
+                  {% include template %}
+                {% endwith %}
+              {% endwith %}
+            {% endfor %}
+        {% endif %}
     {% endif %}
-  {% if page.teampage.team.leader_projects.all %}
-    <h4>{% trans 'Main projects' %}</h4>
-    {% with page.teampage.team.leader_projects.all as projects %}
-        {% include 'projects/project_list.html' %}
-    {% endwith %}
-  {% endif %}
-  {% if page.teampage.team.patner_projects.all %}
-    <h4>{% trans 'Partner projects' %}</h4>
-    {% with page.teampage.team.patner_projects.all as projects %}
-        {% include 'projects/project_list.html' %}
-    {% endwith %}
-  {% endif %}
 {% endblock %}
 
 {% block logo %}