#1034: FastData computing column defaults too early
----------------------+-----------------------------------------------------
Reporter: icc | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: FastData | Version: 0.9a5
Severity: normal | Keywords:
----------------------+-----------------------------------------------------
In SQLObject, a column default can be a simple value or a callable, which
is obscured by the _get_default() method of SQLObject's Column Class. If
'default' is a callable, we shouldn't be calling it until we're ready to
display the form. Currently we aren't doing this. Right now
DataController calls formmaker.fields_for on initialization, and
fields_for gets around to calling column_parms, which sets the default for
the widget equal to the default for the column. This is bad! Those of us
who have default=datetime.now in our model want the form to come up with
TODAYS date as the default, not the date when turbogears was started up!
I think we want to set the defaults each time one of the controllers is
called... so maybe add a new method to DataController called
"_updateWidgetDefaults" that would look through
self.sqlclass.sqlmeta.columns and update the fields in self.form_widget
with the default values? Does that sound like a good approach?
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1034>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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-tickets
-~----------~----~----~----~------~----~------~--~---