> 1) get the top-level IndustrySector? For example, if 'My Company' has
> it's indusrty_sector set to 'Linux kernel development', we'll get 'IT'
> as a top-level; I'd suppose to add a read-only property to the Company
> entity that selects industry_sector.parent until is is None; Say we
> name it 'top_level_industry_sector';
Well,
class Company(Entity):
name = Field(Unicode(128), required=True, nullable=False)
industry_sector = ManyToOne(IndustrySector, required=True)
def toplevel_industry_sector(self):
i_s = self.industry_sector
while i_s.parent is not None:
i_s = i_s.parent
return i_s
toplevel_industry_sector = property(toplevel_industry_sector)
seems to work.
But should I make it a property for Company (as it is done now) or
IndustrySector itself? What are the main disadvantages of both
solutions?
p.s. Sorry for my stupid questions ;)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---