Fix LOS initially closed migration issue
This commit is contained in:
parent
7bbd8688a2
commit
41a3447357
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import openslides.agenda.models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
"""
|
||||||
|
The default formerly was openslides.agenda.models.list_of_speakers_initially_closed
|
||||||
|
This function does not exists anymore, so for new migrations, we replaced it with False.
|
||||||
|
"""
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("agenda", "0010_speaker_point_of_order"),
|
("agenda", "0010_speaker_point_of_order"),
|
||||||
@ -15,8 +17,6 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="listofspeakers",
|
model_name="listofspeakers",
|
||||||
name="closed",
|
name="closed",
|
||||||
field=models.BooleanField(
|
field=models.BooleanField(default=False),
|
||||||
default=openslides.agenda.models.list_of_speakers_initially_closed
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Finn Stutzenstein on 2021-03-22 08:53
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
"""
|
||||||
|
Reverts the previous migration to replace
|
||||||
|
openslides.agenda.models.list_of_speakers_initially_closed
|
||||||
|
with False. If this is a new database and the previous migration was
|
||||||
|
not run before, this one has no effect.
|
||||||
|
"""
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("agenda", "0011_list_of_speakers_closed_default"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="listofspeakers",
|
||||||
|
name="closed",
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
@ -357,13 +357,6 @@ class ListOfSpeakersManager(BaseManager):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def list_of_speakers_initially_closed():
|
|
||||||
"""
|
|
||||||
Return whether a newly created list of speakers is initially closed.
|
|
||||||
"""
|
|
||||||
return config["agenda_list_of_speakers_initially_closed"]
|
|
||||||
|
|
||||||
|
|
||||||
class ListOfSpeakers(RESTModelMixin, models.Model):
|
class ListOfSpeakers(RESTModelMixin, models.Model):
|
||||||
|
|
||||||
objects = ListOfSpeakersManager()
|
objects = ListOfSpeakersManager()
|
||||||
@ -386,7 +379,7 @@ class ListOfSpeakers(RESTModelMixin, models.Model):
|
|||||||
Field for generic relation to a related object. General field to the related object.
|
Field for generic relation to a related object. General field to the related object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
closed = models.BooleanField(default=list_of_speakers_initially_closed)
|
closed = models.BooleanField(default=False)
|
||||||
"""
|
"""
|
||||||
True, if the list of speakers is closed.
|
True, if the list of speakers is closed.
|
||||||
"""
|
"""
|
||||||
|
@ -85,7 +85,10 @@ def listen_to_related_object_post_save(sender, instance, created, **kwargs):
|
|||||||
|
|
||||||
if is_list_of_speakers_content_object:
|
if is_list_of_speakers_content_object:
|
||||||
if created:
|
if created:
|
||||||
ListOfSpeakers.objects.create(content_object=instance)
|
ListOfSpeakers.objects.create(
|
||||||
|
content_object=instance,
|
||||||
|
closed=config["agenda_list_of_speakers_initially_closed"],
|
||||||
|
)
|
||||||
if not instance.list_of_speakers_skip_autoupdate:
|
if not instance.list_of_speakers_skip_autoupdate:
|
||||||
instance_inform_changed_data = True
|
instance_inform_changed_data = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user