]> git.parisson.com Git - mezzo.git/commitdiff
Event : add price description
authorEmilie <zawadzki@ircam.fr>
Mon, 7 Nov 2016 15:31:22 +0000 (16:31 +0100)
committerEmilie <zawadzki@ircam.fr>
Mon, 7 Nov 2016 15:31:22 +0000 (16:31 +0100)
app/organization/agenda/admin.py
app/organization/agenda/migrations/0019_eventpricedescription.py [new file with mode: 0644]
app/organization/agenda/models.py
app/organization/agenda/translation.py
app/templates/agenda/includes/event_metainfo.html

index aa86bf51d7835be391c8965a66321337e87ae75d..7c332f4f398fe8c257cb903cf93de1e9e8be609d 100644 (file)
@@ -61,6 +61,16 @@ class EventRelatedTitleAdmin(TranslationTabularInline):
     model = EventRelatedTitle
 
 
+class EventPriceDescriptionAdmin(TranslationTabularInline):
+
+    model = EventPriceDescription
+
+
+class CustomEventPriceAdmin(BaseTranslationModelAdmin):
+
+    inlines = [EventPriceDescriptionAdmin,]
+
+
 class DynamicContentEventInline(TabularDynamicInlineAdmin):
 
     model = DynamicContentEvent
@@ -111,8 +121,10 @@ class EventTrainingLevelAdmin(BaseTranslationModelAdmin):
 
 
 admin.site.unregister(Event)
+admin.site.unregister(EventPrice)
 admin.site.unregister(EventCategory)
 admin.site.register(EventPublicType, EventPublicTypeAdmin)
 admin.site.register(EventTrainingLevel, EventTrainingLevelAdmin)
 admin.site.register(Event, CustomEventAdmin)
 admin.site.register(EventCategory, CustomEventCategoryAdmin)
+admin.site.register(EventPrice, CustomEventPriceAdmin)
diff --git a/app/organization/agenda/migrations/0019_eventpricedescription.py b/app/organization/agenda/migrations/0019_eventpricedescription.py
new file mode 100644 (file)
index 0000000..d31808f
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.10 on 2016-11-07 15:14
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mezzanine_agenda', '0015_auto_20161021_1937'),
+        ('organization-agenda', '0018_auto_20161104_1820'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='EventPriceDescription',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('description', models.TextField(blank=True, null=True, verbose_name='description')),
+                ('description_fr', models.TextField(blank=True, null=True, verbose_name='description')),
+                ('description_en', models.TextField(blank=True, null=True, verbose_name='description')),
+                ('event_price', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='event_price_description', to='mezzanine_agenda.EventPrice', verbose_name='event_price_description')),
+            ],
+            options={
+                'verbose_name': 'Additionnal description',
+            },
+        ),
+    ]
index e0029aa433d80f22bb5be3cd6dd3b3d4d2f276ae..ba70279c67fdce688c56ab859d48b7ad21ccddd9 100644 (file)
@@ -118,3 +118,12 @@ class DynamicContentEvent(DynamicContent, Orderable):
 
     class Meta:
         verbose_name = 'Dynamic Content Event'
+
+
+class EventPriceDescription(models.Model):
+
+    event_price = models.OneToOneField(EventPrice, verbose_name=_('event_price_description'), related_name='event_price_description', blank=True, null=True, on_delete=models.SET_NULL)
+    description = models.TextField(_('description'), blank=True, null=True)
+
+    class Meta:
+        verbose_name = 'Additionnal description'
index a8584341e6fe17672dc1ad190b19ce36e15a1eaf..45cfb599dfdceab692c24a4013072410265e1cd5 100644 (file)
@@ -73,3 +73,15 @@ class EventRelatedTitleTranslationOptions(TranslationOptions):
 class DynamicContentEventTranslationOptions(TranslationOptions):
 
     fields = ()
+
+
+@register(EventPriceDescription)
+class EventPriceDescriptionTranslationOptions(TranslationOptions):
+
+    fields = ('description', )
+
+
+@register(EventPrice)
+class EventPriceTranslationOptions(TranslationOptions):
+
+    fields = ()
index 123132b91243ce1f78781051a28ea7466566e537..9234d523512c37b860fcb260cecb26d74a01f9da 100644 (file)
                 <div class="page__meta-title page__meta-title--small">{% trans "Prices" %}</div>
                 <p class="page__meta-text">
             {% endif %}
-            {% if price.unit %}
-                {{ price.unit }}:
+            {% if price.event_price_description.description %}
+                {{ price.event_price_description.description }} :
             {% endif %}
-            {{ price.value|floatformat:"-2" }} {% if not forloop.last %} <br /> {% endif %}
+            {{ price.value|floatformat:"-2" }} {{ price.unit }} {% if not forloop.last %} <br /> {% endif %}
             {% if forloop.last %}
                 </p>
             {% endif %}