Parcourir la source

ajout d’un label aux services

Élie Bouttier il y a 8 ans
Parent
commit
eb109faeb5

+ 19 - 0
accounts/migrations/0002_auto_20170206_2358.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-06 22:58
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('accounts', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AlterModelTable(
+            name='profile',
+            table=None,
+        ),
+    ]

+ 1 - 1
services/admin.py

@@ -40,7 +40,7 @@ class ServiceStatusFilter(admin.SimpleListFilter):
 
 
 class ServiceAdmin(admin.ModelAdmin):
-    list_display = ('id', 'adherent', 'service_type', 'start', 'end', 'status')
+    list_display = ('id', 'adherent', 'service_type', 'label', 'start', 'end', 'status')
     list_filter = (ServiceStatusFilter, ServiceTypeFilter,)
 
     def status(self, obj):

+ 20 - 0
services/migrations/0007_service_label.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-06 22:58
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('services', '0006_auto_20170111_1053'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='service',
+            name='label',
+            field=models.CharField(blank=True, default='', max_length=128),
+        ),
+    ]

+ 1 - 0
services/models.py

@@ -52,6 +52,7 @@ class Service(models.Model):
     adherent = models.ForeignKey(Adherent, verbose_name='Adhérent', null=True, blank=True)
     service_type = models.ForeignKey(ServiceType, related_name='services',
                                      verbose_name='Type de service')
+    label = models.CharField(blank=True, default='', max_length=128)
     notes = models.TextField(blank=True, default='')
     contribution = GenericRelation(Payment,
                                    content_type_field='reason_type',

+ 1 - 1
services/templates/services/service_list.html

@@ -9,7 +9,7 @@
     {% for service in object_list %}
     <div class="list-group-item {% if service.is_ongoing %}list-group-item-success{% else %}list-group-item-danger{% endif %}">
         <h4 class="list-group-item-heading">
-            #{{ service.pk }} <b>{{ service.service_type }}</b>
+            #{{ service.pk }} <b>{{ service.service_type }}</b> {{ service.label }}
         </h4>
         <p class="list-group-item-text">
             {{ service.start|default:"depuis toujours" }} – {{ service.end|default:"présent" }}