[Grok-dev] Fields() vs AutoFields()

Martijn Faassen faassen at startifact.com
Tue Jan 27 16:13:11 EST 2009


Jan-Wijbrand Kolman wrote:
> Jeroen Michiel wrote:
>> What is the difference exactly between grok.Fields() and grok.AutoFields().
>> It seems I can use them interchangeably, but as they exist, I figure they
>> both have a separate purpose, but the documentation is not exactly clear on
>> it (or it eludes me).
> 
> They're not really interchangeable. That is, grok.Fields() is used for
> building forms where there is no schema (an interface with schema
> fields) in play. grok.AutoFields is intended to be used for building
> form where there is one.

Note actually that grok.Fields() can also be used with schemas directly. 
AutoFields will attempt to retrieve the appropriate schema from the 
class if it's not given an interface. I usually use grok.Fields this way.

Regards,

Martijn



More information about the Grok-dev mailing list