From 7b48b0932922a1d0a5d601f6d10e2d84f59c65c5 Mon Sep 17 00:00:00 2001 From: test Date: Sat, 23 Mar 2024 14:32:31 +0100 Subject: [PATCH] patch sort and optional description --- .../migrations/0003_auto_20240323_1422.py | 18 ++++++++++++++++++ apps/activity/models.py | 2 ++ apps/activity/views.py | 1 + 3 files changed, 21 insertions(+) create mode 100644 apps/activity/migrations/0003_auto_20240323_1422.py diff --git a/apps/activity/migrations/0003_auto_20240323_1422.py b/apps/activity/migrations/0003_auto_20240323_1422.py new file mode 100644 index 00000000..86f92c21 --- /dev/null +++ b/apps/activity/migrations/0003_auto_20240323_1422.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2024-03-23 13:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('activity', '0002_auto_20200904_2341'), + ] + + operations = [ + migrations.AlterField( + model_name='activity', + name='description', + field=models.TextField(blank=True, default='', verbose_name='description'), + ), + ] diff --git a/apps/activity/models.py b/apps/activity/models.py index 6a070a3e..88cce457 100644 --- a/apps/activity/models.py +++ b/apps/activity/models.py @@ -66,6 +66,8 @@ class Activity(models.Model): description = models.TextField( verbose_name=_('description'), + blank=True, + default="", ) location = models.CharField( diff --git a/apps/activity/views.py b/apps/activity/views.py index 38b87964..f3cc79ad 100644 --- a/apps/activity/views.py +++ b/apps/activity/views.py @@ -76,6 +76,7 @@ class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView context['upcoming'] = ActivityTable( data=upcoming_activities.filter(PermissionBackend.filter_queryset(self.request, Activity, "view")), prefix='upcoming-', + order_by='date_start', ) started_activities = self.get_queryset().filter(open=True, valid=True).distinct().all()