-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2950] Replace case description config flag with an enum
- Loading branch information
1 parent
037d6d8
commit ddaf886
Showing
10 changed files
with
157 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...openzaak/migrations/0060_remove_openzaakconfig_use_zaak_omschrijving_as_title_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Generated by Django 4.2.18 on 2025-01-22 12:06 | ||
import logging | ||
|
||
from django.db import migrations, models | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate_use_zaak_omschrijving_as_title(apps, _): | ||
from open_inwoner.openzaak.constants import ZaakTitleDisplayChoices | ||
|
||
OpenZaakConfig = apps.get_model("openzaak", "OpenZaakConfig") | ||
|
||
if config := OpenZaakConfig.objects.first(): | ||
if config.use_zaak_omschrijving_as_title: | ||
logger.info( | ||
"Setting OpenZaakConfig.derive_zaak_titel_from to %s because " | ||
"OpenZaakConfig.use_zaak_omschrijving_as_title = True", | ||
ZaakTitleDisplayChoices.zaak_titel, | ||
) | ||
config.derive_zaak_titel_from = ZaakTitleDisplayChoices.zaak_titel | ||
else: | ||
logger.info( | ||
"Setting OpenZaakConfig.derive_zaak_titel_from to %s because " | ||
"OpenZaakConfig.use_zaak_omschrijving_as_title = True", | ||
ZaakTitleDisplayChoices.zaak_titel, | ||
) | ||
config.derive_zaak_titel_from = ( | ||
ZaakTitleDisplayChoices.zaaktype_omschrijving | ||
) | ||
|
||
config.save() | ||
|
||
# ZaakTitleDisplayChoices.zaaktype_omschrijving is a newly added option, so it won't | ||
# be the default for anybody. | ||
|
||
|
||
def reverse_migrate_use_zaak_omschrijving_as_title(apps, _): | ||
from open_inwoner.openzaak.constants import ZaakTitleDisplayChoices | ||
|
||
OpenZaakConfig = apps.get_model("openzaak", "OpenZaakConfig") | ||
|
||
if config := OpenZaakConfig.objects.first(): | ||
if config.derive_zaak_titel_from == ZaakTitleDisplayChoices.zaak_titel: | ||
config.use_zaak_omschrijving_as_title = True | ||
else: | ||
config.use_zaak_omschrijving_as_title = False | ||
|
||
config.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("openzaak", "0059_openzaakconfig_show_cases_without_status"), | ||
( | ||
"zgw_consumers", | ||
"0022_set_default_service_slug", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="openzaakconfig", | ||
name="derive_zaak_titel_from", | ||
field=models.CharField( | ||
choices=[ | ||
("zaaktype_title", "The title of the case (`zaak.omschrijving`)"), | ||
( | ||
"zaaktype_omschrijving", | ||
"The description of the case's type (`zaaktype.omschrijving`)", | ||
), | ||
( | ||
"zaaktype_onderwerp", | ||
"The subject of the case's type (`zaaktype.onderwerp`)", | ||
), | ||
], | ||
default="zaaktype_omschrijving", | ||
help_text="Which field from the underlying zaaksysteem to use to display the title for a zaak (e.g. on the Mijn Aanvragen page).", | ||
verbose_name="Derive the case title from", | ||
), | ||
), | ||
migrations.RunPython( | ||
code=migrate_use_zaak_omschrijving_as_title, | ||
reverse_code=reverse_migrate_use_zaak_omschrijving_as_title, | ||
), | ||
migrations.RemoveField( | ||
model_name="openzaakconfig", | ||
name="use_zaak_omschrijving_as_title", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters