From 4712707d6be9b8d79b4eb04d9ac275b83a3bd1d0 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 16 Sep 2020 15:41:11 +0200 Subject: [PATCH] Add amendment projection defaults Creates projection defaults for (paragraph based) amendments. Adds a migration to add amendments as projection defaults. Will only work for paragraph based amendments, other amendments will still be considered motions --- .../app/site/motions/models/view-motion.ts | 9 +++++- .../0034_amendment_projection_defaults.py | 32 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 server/openslides/core/migrations/0034_amendment_projection_defaults.py diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts index 0a14acbc4..38bc38155 100644 --- a/client/src/app/site/motions/models/view-motion.ts +++ b/client/src/app/site/motions/models/view-motion.ts @@ -334,6 +334,13 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers ({ name: Motion.COLLECTIONSTRING, @@ -341,7 +348,7 @@ export class ViewMotion extends BaseViewModelWithAgendaItemAndListOfSpeakers ['name', 'id'] }), slideOptions: slideOptions, - projectionDefaultName: 'motions', + projectionDefaultName: projectionDefaultName, getDialogTitle: this.getAgendaSlideTitle }; } diff --git a/server/openslides/core/migrations/0034_amendment_projection_defaults.py b/server/openslides/core/migrations/0034_amendment_projection_defaults.py new file mode 100644 index 000000000..7c4551008 --- /dev/null +++ b/server/openslides/core/migrations/0034_amendment_projection_defaults.py @@ -0,0 +1,32 @@ +from django.db import migrations + + +def add_amendment_projection_defaults(apps, schema_editor): + """ + Adds projectiondefaults for messages and countdowns. + """ + Projector = apps.get_model("core", "Projector") + ProjectionDefault = apps.get_model("core", "ProjectionDefault") + default_projector = Projector.objects.order_by("pk").first() + + projectiondefaults = [] + + projectiondefaults.append( + ProjectionDefault( + name="amendments", display_name="Amendments", projector=default_projector + ) + ) + + # Create all new projectiondefaults + ProjectionDefault.objects.bulk_create(projectiondefaults) + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0033_live_stream_permission"), + ] + + operations = [ + migrations.RunPython(add_amendment_projection_defaults), + ]