From 5332e866c03a3d0ec699c33f16d188a757df7671 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 7 Oct 2016 11:06:15 +0200 Subject: [PATCH] Add projects and products to team page --- .../migrations/0019_auto_20161007_1045.py | 32 ++++++++++++++++++ app/organization/projects/models.py | 4 +-- app/templates/pages/teampage.html | 33 +++++++++++-------- 3 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 app/organization/projects/migrations/0019_auto_20161007_1045.py 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 index 00000000..75035fdf --- /dev/null +++ b/app/organization/projects/migrations/0019_auto_20161007_1045.py @@ -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), + ] diff --git a/app/organization/projects/models.py b/app/organization/projects/models.py index 1eb9e55a..5666539b 100644 --- a/app/organization/projects/models.py +++ b/app/organization/projects/models.py @@ -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): diff --git a/app/templates/pages/teampage.html b/app/templates/pages/teampage.html index 122e5c60..6cea12a8 100644 --- a/app/templates/pages/teampage.html +++ b/app/templates/pages/teampage.html @@ -106,21 +106,26 @@ {% endblock %} {% block related_project %} - {% if page.teampage.team.leader_projects.all or page.teampage.team.patner_projects.all %} -
+ {% if page.teampage.team.leader_projects.all or page.teampage.team.partner_projects.all %} +
+

{% trans "European and national projects" %}

+ {% 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 %} +

{% trans "Products" %}

+ {% 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 %} -

{% trans 'Main projects' %}

- {% with page.teampage.team.leader_projects.all as projects %} - {% include 'projects/project_list.html' %} - {% endwith %} - {% endif %} - {% if page.teampage.team.patner_projects.all %} -

{% trans 'Partner projects' %}

- {% with page.teampage.team.patner_projects.all as projects %} - {% include 'projects/project_list.html' %} - {% endwith %} - {% endif %} {% endblock %} {% block logo %} -- 2.39.5