Opened 12 years ago

Closed 12 years ago

#639 closed enhancement (fixed)

WTForms form extension hooks

Reported by: Christopher Allan Webber Owned by:
Priority: major Milestone: 0.4.0
Component: programming Keywords: pluginapi
Cc: Parent Tickets:

Description

I wonder if it's possible to do something like this:

  class BlaBlaForm(pluginapi.HookForm):
    _hook_name = 'blabla'
    bla_bla = wtforms.BlaBlaField()

This would require some fancy metaclassing but if it worked, it should be able to allow to attach fields to the form either before or after like the following:

  pluginapi.add_form_field(
     wtforms.SomeFormField(),
     position=before)

Is this possible? Not totally sure. Would be great if it did. Would also involve evil metaclassing. But what part of plugin systems don't involve a bit of evil ;)

Change History (1)

comment:1 by Christopher Allan Webber, 12 years ago

Resolution: fixed
Status: newclosed

It turns out that there's a much more reasonable way to do this. This is now documented as part of the plugin writer API section but as a "tip" in commit baf2c1c96ec4dbcbb74518852ffdf516d670347c ... in truth, it's just a technique for working with hook_transform.

Note: See TracTickets for help on using tickets.