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 that model's database table, so that shouldn't be a problem.
However, db_column doesn't make sense on a ManyToMany field, for
precisely that reason. Either you use a "through" table to specify the
columns via the intermediate table, or it will refer to the primary key
field on the 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 code
> field) through "db_column" directive, because there are several tables
> with such relations...; but I failed. And I still can't clearly
> understand what odel design I need.

One way to try to work out whether your model is close is to look at the
output of "manage.py sql <app_name>" and compare that to the SQL you are
trying to achieve. Then you can at least work out what fields need to be
changed.

> PS. Such field's names, data structure - are not mine work. this
> database was designed over 15 years ago, and maintained by other
> people...

The name of the database columns does not prevent you from having
descriptive names for the model fields. It's well worth the time, for
your own sanity, and ours, to do so. Use the db_column parameter on each
model field to then set the database column name correctly. That is a
nice feature of Django's design: you can still give the Python-level
attributes reasonably understandable names, no matter what sort of
database naming scheme was in place.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to