Skip to content

Commit

Permalink
🗃️ [#76] added documenthandeling fields directly in the document mode…
Browse files Browse the repository at this point in the history
…l. This is because we only allow one action as per now, and migrating this in the future to its own model when we allow multiple instances is very easy to do. Also for now we can just use the publications 'verantwoordelijke' field as the 'wasAssciatedWith' because for now these two won't differ from eachother.
  • Loading branch information
bart-maykin committed Nov 14, 2024
1 parent 8f55a8b commit 1dc57b9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/woo_publications/publications/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ class PublicationStatusOptions(models.TextChoices):
published = "gepubliceerd", _("Published")
concept = "concept", _("Concept")
revoked = "ingetrokken", _("Revoked")


class DocumentActionTypeOptions(models.TextChoices):
signed = "ondertekening", _("Signed")
received = "ontvangst", _("Received")
declared = "vaststelling", _("Declared")
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.16 on 2024-11-14 11:00

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("publications", "0010_alter_document_identifier"),
]

operations = [
migrations.AddField(
model_name="document",
name="soort_handeling",
field=models.CharField(
choices=[
("ondertekening", "Signed"),
("ontvangst", "Received"),
("vaststelling", "Declared"),
],
default="vaststelling",
verbose_name="action type",
),
),
]
9 changes: 8 additions & 1 deletion src/woo_publications/publications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from woo_publications.logging.typing import ActingUser
from woo_publications.metadata.models import InformationCategory

from .constants import PublicationStatusOptions
from .constants import DocumentActionTypeOptions, PublicationStatusOptions

# when the document isn't specified both the service and uuid needs to be unset
_DOCUMENT_NOT_SET = models.Q(document_service=None, document_uuid=None)
Expand Down Expand Up @@ -264,6 +264,13 @@ class Document(models.Model):
),
)

# documenthandeling fields
soort_handeling = models.CharField(
verbose_name=_("action type"),
choices=DocumentActionTypeOptions.choices,
default=DocumentActionTypeOptions.declared,
)

# Documents API integration
document_service = models.ForeignKey(
"zgw_consumers.Service",
Expand Down

0 comments on commit 1dc57b9

Please sign in to comment.