Rename forms/deform template (drop buefy suffix)
for now, deprecate `form.render()` method and just use `render_deform()` - but probably should change that to something else eventually..?
This commit is contained in:
parent
cd7c1bba21
commit
1103b09a76
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
# Copyright © 2010-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -794,12 +794,11 @@ class Form(object):
|
|||
def set_vuejs_field_converter(self, field, converter):
|
||||
self.vuejs_field_converters[field] = converter
|
||||
|
||||
def render(self, template=None, **kwargs):
|
||||
if not template:
|
||||
template = '/forms/form.mako'
|
||||
context = kwargs
|
||||
context['form'] = self
|
||||
return render(template, context)
|
||||
def render(self, **kwargs):
|
||||
warnings.warn("Form.render() is deprecated (for now?); "
|
||||
"please use Form.render_deform() instead",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
return self.render_deform(**kwargs)
|
||||
|
||||
def make_deform_form(self):
|
||||
if not hasattr(self, 'deform_form'):
|
||||
|
@ -841,14 +840,14 @@ class Form(object):
|
|||
|
||||
def render_deform(self, dform=None, template=None, **kwargs):
|
||||
if not template:
|
||||
template = '/forms/deform_buefy.mako'
|
||||
template = '/forms/deform.mako'
|
||||
|
||||
if dform is None:
|
||||
dform = self.make_deform_form()
|
||||
|
||||
# TODO: would perhaps be nice to leverage deform's default rendering
|
||||
# someday..? i.e. using Chameleon *.pt templates
|
||||
# return form.render()
|
||||
# return dform.render()
|
||||
|
||||
context = kwargs
|
||||
context['form'] = self
|
||||
|
|
|
@ -150,8 +150,8 @@
|
|||
|
||||
<%def name="render_form()">
|
||||
## TODO: should use self.render_form_buttons()
|
||||
## ${form.render(form_id='batch-form', buttons=capture(self.render_form_buttons))|n}
|
||||
${form.render(form_id='batch-form', buttons=capture(buttons))|n}
|
||||
## ${form.render_deform(form_id='batch-form', buttons=capture(self.render_form_buttons))|n}
|
||||
${form.render_deform(form_id='batch-form', buttons=capture(buttons))|n}
|
||||
</%def>
|
||||
|
||||
<%def name="render_this_page()">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<%def name="render_form_buttons()"></%def>
|
||||
|
||||
<%def name="render_form()">
|
||||
${form.render(buttons=capture(self.render_form_buttons))|n}
|
||||
${form.render_deform(buttons=capture(self.render_form_buttons))|n}
|
||||
</%def>
|
||||
|
||||
<%def name="render_buefy_form()">
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
${form.render_deform(buttons=buttons)|n}
|
|
@ -64,7 +64,7 @@
|
|||
${parent.modify_this_page_vars()}
|
||||
<script type="text/javascript">
|
||||
|
||||
## TODO: ugh, an awful lot of duplicated code here (from /forms/deform_buefy.mako)
|
||||
## TODO: ugh, an awful lot of duplicated code here (from /forms/deform.mako)
|
||||
|
||||
let ${form.component_studly} = {
|
||||
template: '#${form.component}-template',
|
||||
|
|
Loading…
Reference in a new issue