From d9a8e8cb9c0fd73268a43869242a11e1cd7a7257 Mon Sep 17 00:00:00 2001 From: Lars Veldscholte Date: Thu, 21 Dec 2017 22:38:04 +0100 Subject: [PATCH] Alter Event fields Increase char limit of note_field to 100, add (optional) long description --- app/forms/EventForm.py | 2 ++ app/migrations/0013_auto_20171221_2234.py | 28 +++++++++++++++++++++++ app/models/Event.py | 3 ++- app/templates/event_detail.html | 2 +- app/templates/include/event_form.html | 1 + 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 app/migrations/0013_auto_20171221_2234.py diff --git a/app/forms/EventForm.py b/app/forms/EventForm.py index 09b71dd..6e492b2 100644 --- a/app/forms/EventForm.py +++ b/app/forms/EventForm.py @@ -24,6 +24,7 @@ class Meta: fields = [ 'name', 'description', + 'long_description', 'committee', 'start_at', 'end_at', @@ -41,6 +42,7 @@ class Meta: labels = { 'name': _('Naam'), 'description': _("Beschrijving"), + 'long_description': _("Lange beschrijving"), 'committee': _("Commissie"), 'start_at': _("Begindatumtijd"), 'end_at': _("Einddatumtijd"), diff --git a/app/migrations/0013_auto_20171221_2234.py b/app/migrations/0013_auto_20171221_2234.py new file mode 100644 index 0000000..04fa847 --- /dev/null +++ b/app/migrations/0013_auto_20171221_2234.py @@ -0,0 +1,28 @@ +# Generated by Django 2.0 on 2017-12-21 21:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0012_auto_20171023_1947'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='long_description', + field=models.TextField(blank=True), + ), + migrations.AlterField( + model_name='event', + name='note_field', + field=models.CharField(blank=True, default='', max_length=100), + ), + migrations.AlterField( + model_name='user', + name='last_name', + field=models.CharField(blank=True, max_length=150, verbose_name='last name'), + ), + ] diff --git a/app/models/Event.py b/app/models/Event.py index d689d5a..ead6ae9 100644 --- a/app/models/Event.py +++ b/app/models/Event.py @@ -14,13 +14,14 @@ class Event(models.Model): name = models.CharField(max_length=25) description = models.TextField(max_length=255) + long_description = models.TextField(blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) published_at = models.DateTimeField(default=timezone.now, blank=True) deadline_at = models.DateTimeField() start_at = models.DateTimeField() end_at = models.DateTimeField() - note_field = models.CharField(max_length=25, default='', blank=True) + note_field = models.CharField(max_length=100, default='', blank=True) note_field_options = CommaSeparatedStringsField(max_length=255, default='', blank=True) note_field_required = models.BooleanField() note_field_public = models.BooleanField() diff --git a/app/templates/event_detail.html b/app/templates/event_detail.html index 6d0c0e9..f9d981e 100644 --- a/app/templates/event_detail.html +++ b/app/templates/event_detail.html @@ -26,7 +26,7 @@

{{ event.name }} {{ event.committee.name }}

{% trans "Kosten:" %} €{{ event.price }}


-

{{ event.description }}

+

{{ event.long_description|default:event.description }}

{% if event.places != None %}
diff --git a/app/templates/include/event_form.html b/app/templates/include/event_form.html index ea28c88..a4c8814 100644 --- a/app/templates/include/event_form.html +++ b/app/templates/include/event_form.html @@ -16,6 +16,7 @@

{{ heading }}

{% bootstrap_field form.name layout='horizontal' %} {% bootstrap_field form.description layout='horizontal' %} + {% bootstrap_field form.long_description layout='horizontal' %} {% bootstrap_field form.committee layout='horizontal' %} {% bootstrap_field form.location layout='horizontal' %} {% bootstrap_field form.price layout='horizontal' addon_before='€' %}