Add support for Buefy autocomplete; several other form tweaks

at least the Edit User form should work now, for instance
This commit is contained in:
Lance Edgar 2019-06-08 13:46:00 -05:00
parent d7e19865de
commit 2b6d88105c
16 changed files with 390 additions and 42 deletions

View file

@ -760,6 +760,29 @@ class Form(object):
context['render_field_readonly'] = self.render_field_readonly
return render(template, context)
def get_vuejs_model_value(self, field):
"""
This method must return "raw" JS which will be assigned as the initial
model value for the given field. This JS will be written as part of
the overall response, to be interpreted on the client side.
"""
if isinstance(field.schema.typ, colander.Date):
# TODO: don't recall why "always null" here?
return 'null'
if isinstance(field.schema.typ, deform.FileData):
# TODO: don't recall why "always null" here?
return 'null'
if isinstance(field.schema.typ, colander.Set):
if field.cstruct is colander.null:
return '[]'
if field.cstruct is colander.null:
return 'null'
return json.dumps(field.cstruct)
def messages_json(self, messages):
dump = json.dumps(messages)
dump = dump.replace("'", ''')