Skip to content
Snippets Groups Projects
Commit b87db5b0 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-573: a dataproduct should have a unique path

parent a59a5de0
No related branches found
No related tags found
1 merge request!343Resolve TMSS-557 and TMSS-307
......@@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
from datetime import datetime, timedelta
from django.db.models import Model, ForeignKey, OneToOneField, CharField, DateTimeField, BooleanField, IntegerField, BigIntegerField, \
ManyToManyField, CASCADE, SET_NULL, PROTECT, QuerySet, BigAutoField
ManyToManyField, CASCADE, SET_NULL, PROTECT, QuerySet, BigAutoField, UniqueConstraint
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.auth.models import User
from .specification import AbstractChoice, BasicCommon, Template, NamedCommon, annotate_validate_add_defaults_to_doc_using_template
......@@ -375,6 +375,9 @@ class Dataproduct(BasicCommon):
sap = ForeignKey('SAP', on_delete=PROTECT, null=True, related_name="dataproducts", help_text='SAP this dataproduct was generated out of (NULLable).')
global_identifier = OneToOneField('SIPidentifier', editable=False, null=False, on_delete=PROTECT, help_text='The global unique identifier for LTA SIP.')
class Meta:
constraints = [UniqueConstraint(fields=['directory', 'filename'], name='%(class)s_unique_path')]
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
annotate_validate_add_defaults_to_doc_using_template(self, 'specifications_doc', 'specifications_template')
annotate_validate_add_defaults_to_doc_using_template(self, 'feedback_doc', 'feedback_template')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment