From 1351febef19f2ef848625c848a711366961587f1 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 12 Nov 2021 16:58:31 +0000 Subject: [PATCH] side by side media --- app/event/migrations/0005_event_media.py | 18 ++++++++++++++++++ app/event/models.py | 1 + app/event/views.py | 3 ++- app/templates/index.html | 24 ++++++++++++++++++------ 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 app/event/migrations/0005_event_media.py diff --git a/app/event/migrations/0005_event_media.py b/app/event/migrations/0005_event_media.py new file mode 100644 index 0000000..427ddc4 --- /dev/null +++ b/app/event/migrations/0005_event_media.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.9 on 2021-11-12 16:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('event', '0004_alter_event_options'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='media', + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/app/event/models.py b/app/event/models.py index 7196a52..9c75961 100644 --- a/app/event/models.py +++ b/app/event/models.py @@ -16,6 +16,7 @@ class Event(models.Model): type = models.CharField(blank=True, default='', max_length=1024) date = models.CharField(blank=True, null=True, max_length=1024) body = models.TextField(blank=True, null=True) + media = models.TextField(blank=True, null=True) data = models.JSONField(default=dict, blank=True, editable=False) diff --git a/app/event/views.py b/app/event/views.py index 948db4c..2166164 100644 --- a/app/event/views.py +++ b/app/event/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render - +from django.conf import settings from .models import Event from ..page.models import Page @@ -7,6 +7,7 @@ from ..page.models import Page def index(request, slug=''): context = {} + context['settings'] = settings context['events'] = Event.objects.all().order_by('position') context['postscript'] = Page.objects.get(slug='postscript') context['intro'] = Page.objects.get(slug='intro') diff --git a/app/templates/index.html b/app/templates/index.html index 09e3ec5..5277932 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,6 +1,5 @@ {% extends "base.html" %} -{% block title %} -{% endblock title %} +{% block title %}{{ settings.title }}{% endblock title %} {% block main %}
@@ -9,12 +8,25 @@
{% for event in events %}
- {% if request.user.is_staff %} - [edit] - {% endif %}

{{ event.title | safe }}

{{ event.date }}
- {{ event.body | safe }} + {% if event.media %} +
+
+ {{ event.media | safe }} +
+
+ {{ event.body | safe }} +
+
+ {% else %} + {{ event.body | safe }} + {% endif %} + {% if request.user.is_staff %} + + {% endif %}
{% endfor %}