Skip to content

Commit

Permalink
Merge pull request #434 from maykinmedia/feature/1048-openzaak-max-fi…
Browse files Browse the repository at this point in the history
…lesize-and-allowed-extensions

[#1048] Feature/add filesize and allowed extensions to openzaak
  • Loading branch information
alextreme authored Jan 24, 2023
2 parents 41062e3 + cec24bf commit fb2f5e0
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/open_inwoner/openzaak/migrations/0006_auto_20230123_1619.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 3.2.15 on 2023-01-23 15:19

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


class Migration(migrations.Migration):

dependencies = [
("openzaak", "0005_openzaakconfig_zaak_max_confidentiality"),
]

operations = [
migrations.AddField(
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=[
"pdf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx",
"vsd",
"png",
"gif",
"jpg",
"tiff",
"msg",
"txt",
"rtf",
"jpeg",
"bmp",
],
help_text="A list of the allowed file extensions.",
size=None,
),
),
migrations.AddField(
model_name="openzaakconfig",
name="max_upload_size",
field=models.PositiveIntegerField(
default=50,
help_text="The max size of the file (in MB) which is uploaded.",
verbose_name="Max upload file size (in MB)",
),
),
]
32 changes: 32 additions & 0 deletions src/open_inwoner/openzaak/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from django_better_admin_arrayfield.models.fields import ArrayField
from solo.models import SingletonModel
from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen
from zgw_consumers.constants import APITypes
Expand Down Expand Up @@ -50,6 +51,37 @@ class OpenZaakConfig(SingletonModel):
verbose_name=_("Documents confidentiality"),
help_text=_("Select confidentiality level of documents to display for cases"),
)
max_upload_size = models.PositiveIntegerField(
verbose_name=_("Max upload file size (in MB)"),
default=50,
help_text=_("The max size of the file (in MB) which is uploaded."),
)
allowed_file_extensions = ArrayField(
models.CharField(
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",
],
help_text=_("A list of the allowed file extensions."),
)

class Meta:
verbose_name = _("Open Zaak configuration")

0 comments on commit fb2f5e0

Please sign in to comment.