Skip to content

Commit

Permalink
Bring validate_relatedLot (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmbdsm authored and leits committed Nov 20, 2018
1 parent 11fb8de commit 7594ae3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openregistry/assets/basic/models.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from schematics.types import StringType
from schematics.types import StringType, ValidationError
from schematics.types.compound import ModelType, ListType
from zope.interface import implementer

Expand All @@ -18,3 +18,7 @@ class Asset(BaseAsset):
_internal_type = 'basic'
assetType = StringType(default="basic")
additionalClassifications = ListType(ModelType(AssetAdditionalClassification), default=list())

def validate_relatedLot(self, data, lot):
if data['status'] == 'active' and not lot:
raise ValidationError(u'This field is required.')

0 comments on commit 7594ae3

Please sign in to comment.