Thanks Patrick,

> actually, i don´t really see a difference between model 1 and 2.

In model 1, there is no direct relationship between the company table
and posting table, and for the company to find out what news it has, it
has to go through the users table. Also, for a posting to find out to
which company it belongs to, it has to ask it's author (user) which
company it belongs too.

It might seem trivial, but considering I am relating another 20 tables
to company with Model 1's philosophy, I want to make sure I am not
making a big mistake. Here is an example of how my tables are setup:

Company ---1-to-many---> Contact ---1-to-1---> Person ----1-to-1--->
Employee

Now, in order for Company #2222 to figure out what Employees it has, I
have to run
employees.get_list(where=['(select company_id from table_contacts where
id="table_employees"."person_id")= 2222'])

which is not pleasent. I was thinking to place a company ID to all my
nested tables to boost performance, but that seems to be broken and
redundant.

I hope you have a better understanding of my problem.

> maybe i don't fully understand what you´re looking for but since news are
> posted by a user, you need a field "user_id" for the news.

A valid solution, that I have used repeatedly before, but my
understanding is user_id shouldn't be explicitly defined as django
takes pride for taking care of such details. I think Django should
include such relationship.

> > I maybe wrong but I don't think (news.get_user.username) works in
> > templates. I have to double check.

> it does (i´m using it).
Glad to hear. I will be needing it :)

Regards,
Mike

Reply via email to