--- On Thu, 7/8/10, Diez B. Roggisch <[email protected]> wrote:
> Why all this Id-business? Assign
> algeria to algiers.country.
>
> Diez
>
My code talks to a black box that gives it only ids. It would be nice if my
models adapt to this black box without any middleware code that transforms
thoses ids to instances of classes they represent; that's what my models are
doing right know, i.e :
<code>
class City(BaseModel):
def __init__(self,*args,**kw):
BaseModel.__init__(self,*args,**kw)
self.country = Country.get(kw.get('country_id'))
</code>
It would be good if I didn't have to do this in each model but rather in
BaseModel.__init__ with a generic code.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en.