X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fcore%2Fmodels%2Fplcorebase.py;h=95959f4e064118d0dda496a67e2a371847979178;hb=1cd32f69aa781a03adf89da7c42b0888fd1b937e;hp=612e925c01f1038181f31646dbfb06b153be2930;hpb=8778feefd0ca9e36e6ad9b1144bedf8abd135b7e;p=plstackapi.git diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py index 612e925..95959f4 100644 --- a/planetstack/core/models/plcorebase.py +++ b/planetstack/core/models/plcorebase.py @@ -206,6 +206,21 @@ class PlCoreBase(models.Model): # , DiffModelMixIn): def is_ephemeral(cls): return cls in ephemeral_models + def getValidators(self): + """ primarily for REST API, return a dictionary of field names mapped + to lists of the type of validations that need to be applied to + those fields. + """ + validators = {} + for field in self._meta.fields: + l = [] + if field.blank==False: + l.append("notBlank") + validators[field.name] = l + return validators + + +