From: Andreas K. <an...@ko...> - 2005-09-09 12:54:23
|
Hi! I'd like to define a default for one of my classes: class Worktime(SQLObject): customer =3D ForeignKey("customer", default=3DWHATDOIPUTHERE) task =3D ForeignKey("task") ... Now every row of Worktime must have a customer that is not NULL/None, while the task assignment might be NULL/None (because it's not clear against what task some time will get billed, while it's clear for which customer the time was spent). Now, a _set_customer setter doesn't work, because it needs the corresponding .task value, and it seems that _set_customer doesn't get called by Worktime(...) Supplying a callable default value would seem to be ok, BUT the callable doesn't get any context (like arguments to the constructor, the row object). Andreas |