Re: need help with model design and table relationship

2009-08-10 Thread Unnamed_Hero
Here is the solution. There is no need in Many-to-many here. In people table I've set corp's unique number as a ForeignKey to Corp's table. In a template: {% for i in result %} {% for persons in i.dolgnost_set.all %} {{ person.field1 }} where Dolgnost - a table with people.

Re: need help with model design and table relationship

2009-08-05 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 14:40 -0700, Unnamed_Hero wrote: > > > And you still haven't reduced it to a simple case that fails with a > > specific piece of data at the interactive prompt. You are trying to > > debug through three layers of curtains here. Why not remove the extra > > layers and work

Re: need help with model design and table relationship

2009-08-04 Thread Unnamed_Hero
> And you still haven't reduced it to a simple case that fails with a > specific piece of data at the interactive prompt. You are trying to > debug through three layers of curtains here. Why not remove the extra > layers and work directly with the ORM to debug an ORM problem, as I > suggested in

Re: need help with model design and table relationship

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 08:27 -0700, Unnamed_Hero wrote: [...] > And I still get > Caught an exception while rendering:relation "C12B_boss" doesn't > exist And you still haven't reduced it to a simple case that fails with a specific piece of data at the interactive prompt. You are trying to debug

Re: need help with model design and table relationship

2009-08-03 Thread Unnamed_Hero
And again for your explanations. So I have changed my models as you advise. Also I've made a form from c12b model, and when it displays - I see all peoples from table with people. But I still can't fetch any results Maybe by queryset isn't good. manage.py sql return this: people table:

Re: need help with model design and table relationship

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 03:19 -0700, Unnamed_Hero wrote: > Thanks for your reply. > > And the point is that (forgot to say)... the boss field in c12b table > doesn't exists, it is virtual and exists only in my model. When you add a ManyToManyField to a Django model, it doesn't create a column in

Re: need help with model design and table relationship

2009-08-03 Thread Unnamed_Hero
Thanks for your reply. And the point is that (forgot to say)... the boss field in c12b table doesn't exists, it is virtual and exists only in my model. I think, this trick can work for me, but I've got (c12b_boss relation does not exist). I thought, that if I point it to a real A22 field (unique

Re: need help with model design and table relationship

2009-08-02 Thread Malcolm Tredinnick
On Sun, 2009-08-02 at 14:08 -0700, Unnamed_Hero wrote: > I have a table with a list of corporations; each corp has a field with > it unique number. > There is a table, filled with people, each record contains a field > with a corp's unique field (where each person works) > > Task: when