I created a widget with a custom label contained in a seperate module.
I have a form created like this:

    form = widgets.TableForm(widgets=[widget0, widget1, widget2,
widget3,
    widget4, widget5, widget6], submittext="Save")

The custom widget is widget6.  If created like this, it displays as the
first widget in the form (not good):

    class CustomLabel(widgets.Widget):
        template = """<label for="${widget.name}"
class="field_label">My Label</label>"""

    custom_widget = widgets.TextField(name="custom_widget")
    custom_widget.label = CustomLabel()

In this case, widget6 (custom_widget) is created when the module is
loaded.

If created like this, it displays as the last widget (as it is supposed
to):

    def getCustomWidget():
        custom_widget = widgets.TextField(name="custom_widget")
        custom_widget.label = CustomLabel()
        return custom_widget

I'm thinking the ordering should be determined by the list order of the
TableForm widgets parameter.  Maybe I've approached this wrong.  Any
suggestions are appreciated.

Reply via email to