Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1048] Feature/add filesize and allowed extensions to openzaak #434

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/open_inwoner/openzaak/migrations/0006_auto_20230123_1106.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Django 3.2.15 on 2023-01-23 10:06

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.TextField(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",
),
),
]
31 changes: 31 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,36 @@ 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"),
default=50,
help_text=_("The max size of the file (in MB) which is uploaded."),
)
allowed_file_extensions = ArrayField(
models.TextField(
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."),
)

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