Am 06.02.2011 21:58 schrieb Nate:
I'm new at this and am wondering the proper place to instantiate a widget. Specifically, I'm trying to make an autocomplete form (http:// docs.turbogears.org/2.0/RoughDocs/ToscaWidgets/Cookbook/AutoComplete) but in all of the tutorials I've found, I can't seem to find WHERE to instantiate a widget (or at least the best/proper place to instantiate a widget). Should it by in my model as a separate .py file? Do I then need to create another database to deal with that object? Or should I instantiate in the __init__.py in my model? Or is it somewhere else?
I usually create "lib" and "widgets" packages inside TG projects. Sometimes I also create a "widgets/templates" subpackage for the widget templates. The controller modules can then import from the "lib" and "wdigets" packages and assign the widgets to tmpl_context.
In any case, don't put them into the model package, they don't belong there. In the MVC pattern, widgets clearly belong to "V", not "M".
-- Christoph -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

