Skip to content

Commit

Permalink
Merge pull request #437 from maykinmedia/feature/1072-fix-openzaak-al…
Browse files Browse the repository at this point in the history
…lowed-extensions-field

[#1072] Fix/openzaak default value for allowed extensions
  • Loading branch information
Bartvaderkin authored Jan 25, 2023
2 parents 74d1813 + 25b6b01 commit f4b9e00
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.15 on 2023-01-25 10:12

from django.db import migrations, models
import django_better_admin_arrayfield.models.fields
import open_inwoner.openzaak.models


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0006_auto_20230123_1619"),
]

operations = [
migrations.AlterField(
model_name="openzaakconfig",
name="allowed_file_extensions",
field=django_better_admin_arrayfield.models.fields.ArrayField(
base_field=models.CharField(
max_length=8, verbose_name="Allowed file extensions"
),
default=open_inwoner.openzaak.models.generate_default_file_extensions,
help_text="A list of the allowed file extensions.",
size=None,
),
),
]
42 changes: 23 additions & 19 deletions src/open_inwoner/openzaak/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@
from zgw_consumers.constants import APITypes


def generate_default_file_extensions():
return [
"pdf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx",
"vsd",
"png",
"gif",
"jpg",
"tiff",
"msg",
"txt",
"rtf",
"jpeg",
"bmp",
]


class OpenZaakConfig(SingletonModel):
"""
Global configuration and defaults for zaken and catalogi services.
Expand Down Expand Up @@ -61,25 +83,7 @@ class OpenZaakConfig(SingletonModel):
verbose_name=_("Allowed file extensions"),
max_length=8,
),
default=[
"pdf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx",
"vsd",
"png",
"gif",
"jpg",
"tiff",
"msg",
"txt",
"rtf",
"jpeg",
"bmp",
],
default=generate_default_file_extensions,
help_text=_("A list of the allowed file extensions."),
)

Expand Down

0 comments on commit f4b9e00

Please sign in to comment.