From dfe0f49655da1866b3533878dbbe69927c0841ae Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 20 May 2019 16:24:14 -0500 Subject: [PATCH] Add basic/generic Buefy support to the Form class mostly just affects rendering, apparently backend logic needn't really change? --- tailbone/forms/core.py | 5 ++++- tailbone/templates/reports/generate.mako | 2 +- tailbone/views/master.py | 5 +++++ tailbone/views/reports.py | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tailbone/forms/core.py b/tailbone/forms/core.py index 0413b491..2238cb06 100644 --- a/tailbone/forms/core.py +++ b/tailbone/forms/core.py @@ -340,7 +340,7 @@ class Form(object): def __init__(self, fields=None, schema=None, request=None, mobile=False, readonly=False, readonly_fields=[], model_instance=None, model_class=None, nodes={}, enums={}, labels={}, renderers=None, hidden={}, widgets={}, defaults={}, validators={}, required={}, helptext={}, focus_spec=None, - action_url=None, cancel_url=None): + action_url=None, cancel_url=None, use_buefy=None): self.fields = None if fields is not None: @@ -374,6 +374,7 @@ class Form(object): self.focus_spec = focus_spec self.action_url = action_url self.cancel_url = cancel_url + self.use_buefy = use_buefy def __contains__(self, item): return item in self.fields @@ -685,6 +686,8 @@ class Form(object): if not template: if self.readonly: template = '/forms/form_readonly.mako' + elif self.use_buefy: + template = '/forms/form_buefy.mako' else: template = '/forms/form.mako' context = kwargs diff --git a/tailbone/templates/reports/generate.mako b/tailbone/templates/reports/generate.mako index dafa3a5b..7ec901e8 100644 --- a/tailbone/templates/reports/generate.mako +++ b/tailbone/templates/reports/generate.mako @@ -16,7 +16,7 @@

${report.__doc__}

- ${form.render(template='/forms/form{}.mako'.format('_buefy' if use_buefy else ''))|n} + ${form.render()|n}