api: makes sure field type is always part of the schema
This commit is contained in:
parent
26d3c95173
commit
4c8f8278b4
|
@ -142,6 +142,7 @@ def test_formdef_schema():
|
|||
resp = get_app(pub).get('/test/schema')
|
||||
assert resp.json['name'] == 'test'
|
||||
assert resp.json['fields'][0]['label'] == 'foobar'
|
||||
assert resp.json['fields'][0]['type'] == 'string'
|
||||
|
||||
def test_categories():
|
||||
Category.wipe()
|
||||
|
|
|
@ -150,6 +150,8 @@ class Field(object):
|
|||
if hasattr(self, attribute) and getattr(self, attribute) is not None:
|
||||
val = getattr(self, attribute)
|
||||
field[attribute] = val
|
||||
if not 'type' in field:
|
||||
field['type'] = self.key
|
||||
return field
|
||||
|
||||
def init_with_json(self, elem, include_id=False):
|
||||
|
|
Loading…
Reference in New Issue