add config.value.mandatory()
This commit is contained in:
parent
814c8ca96b
commit
260cd77d55
|
@ -83,7 +83,7 @@ class TiramisuOptionOption:
|
||||||
|
|
||||||
def properties(self) -> List[str]:
|
def properties(self) -> List[str]:
|
||||||
props = []
|
props = []
|
||||||
model = self.model[self._path]
|
model = self.model.get(self._path, {})
|
||||||
if model.get('required'):
|
if model.get('required'):
|
||||||
#FIXME 'empty', 'needs_len'
|
#FIXME 'empty', 'needs_len'
|
||||||
props.append('mandatory')
|
props.append('mandatory')
|
||||||
|
@ -435,8 +435,7 @@ class ContextValue(_Value):
|
||||||
self.form = form
|
self.form = form
|
||||||
first = next(iter(schema.keys()))
|
first = next(iter(schema.keys()))
|
||||||
self.path = first.rsplit('.', 1)[0]
|
self.path = first.rsplit('.', 1)[0]
|
||||||
schema = {'properties': schema}
|
self.schema = {'properties': schema}
|
||||||
self.schema = schema
|
|
||||||
self.temp = temp
|
self.temp = temp
|
||||||
|
|
||||||
def __call__(self) -> TiramisuOptionValue:
|
def __call__(self) -> TiramisuOptionValue:
|
||||||
|
@ -448,6 +447,14 @@ class ContextValue(_Value):
|
||||||
path,
|
path,
|
||||||
index)
|
index)
|
||||||
|
|
||||||
|
def mandatory(self):
|
||||||
|
# config.value.mandatory()
|
||||||
|
for key, value in self.dict().items():
|
||||||
|
if self.model.get(key, {}).get('required') and \
|
||||||
|
value is None or \
|
||||||
|
(self.schema.get('isMulti') and (None in value or '' in value)):
|
||||||
|
yield key
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
# config
|
# config
|
||||||
|
|
Loading…
Reference in New Issue