git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8778fee
)
add getValidators function
author
Scott Baker
<smbaker@gmail.com>
Tue, 25 Nov 2014 08:49:17 +0000
(
00:49
-0800)
committer
Scott Baker
<smbaker@gmail.com>
Tue, 25 Nov 2014 08:49:17 +0000
(
00:49
-0800)
planetstack/core/models/plcorebase.py
patch
|
blob
|
history
diff --git
a/planetstack/core/models/plcorebase.py
b/planetstack/core/models/plcorebase.py
index
612e925
..
95959f4
100644
(file)
--- 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
+
+
+