I was just considering how I might add custom attributes to fields in
my models. I need to render forms that have a hierarchy of sorts,
fields need to have subfields. Of course I'll need some custom code to
generate forms. I'd like to include a 'parent' attribute on all of my
fields so I don't have to define a field hierarchy outside of my
models.

A 'parent' attribute is way too application specific to consider
adding it to django.core.meta.fields.Field, but I imagine app specific
extentions of both models and fields would be very useful to a lot of
people. (I'm not sure if you can add arbitrary class attributes to
META or not... I'm guessing no though.)

In formencode, Ian Bicking allows a 'state' argument in validator
constructors for app specific uses. I'm not sure that this would be
the *best* way to enable extensions to fields, but it would probably
work. Does anyone have any ideas on how else this might be
implemented? Does anyone else need it? I'm willing to write the
patches.

Thanks,
Joseph

Reply via email to