]> git.parisson.com Git - mezzo.git/commitdiff
Network : add css class on organization type
authorEmilie <zawadzki@ircam.fr>
Wed, 12 Oct 2016 15:11:56 +0000 (17:11 +0200)
committerEmilie <zawadzki@ircam.fr>
Wed, 12 Oct 2016 15:11:56 +0000 (17:11 +0200)
app/organization/network/migrations/0037_organizationtype_css_class.py [new file with mode: 0644]
app/organization/network/models.py
app/organization/network/views.py
app/templates/network/organization_list.html

diff --git a/app/organization/network/migrations/0037_organizationtype_css_class.py b/app/organization/network/migrations/0037_organizationtype_css_class.py
new file mode 100644 (file)
index 0000000..ba03782
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-10-12 15:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-network', '0036_auto_20161005_1509'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='organizationtype',
+            name='css_class',
+            field=models.CharField(blank=True, help_text='Determine color on map.', max_length=64, null=True, verbose_name='class css'),
+        ),
+    ]
index 69430548dcaa854887c11b092bed19dd5461cbc2..b7028907a4767cb276c4c69da54fe27f9aa5a5e4 100644 (file)
@@ -153,6 +153,8 @@ class OrganizationBlock(Block):
 class OrganizationType(Named):
     """(OrganizationType description)"""
 
+    css_class = models.CharField(_('class css'), max_length=64, blank=True, null=True,  help_text="Determine color on map.")
+
     class Meta:
         verbose_name = _('organization type')
         ordering = ['name',]
index 46bfbb22075620d180cf13334444502553e9eac2..5b2fd351bb8a3ee8c313c34e8b0aa53152edbe9f 100644 (file)
@@ -64,5 +64,5 @@ class OrganizationListView(ListView):
 
     def get_context_data(self, **kwargs):
         context = super(OrganizationListView, self).get_context_data(**kwargs)
-        context['organization_types'] = self.get_queryset().values_list('type__name', flat=True).order_by('type__name').distinct('type__name')
+        context['organization_types'] = self.get_queryset().values_list('type__name', 'type__css_class').order_by('type__name').distinct('type__name')
         return context
index b683b11e3f039539af2c884f3a621dc014ab7642..6b0206f940e7d0763eefaf34fe6936b00288596a 100644 (file)
@@ -59,7 +59,7 @@
                                     {{ organization.city }}, {{ organization.country.name }}
                                 </div>
                                 <div class="">
-                                    {{ organization.type }}
+                                    {{ organization.type }}, {{ organization.type.css_class }}
                                 </div>
                             </li>