Suppose I have the following tables:

'Person'
id    name
--    ----
1     larry
2     moe
3     curley

'Activity'
id    description
--    -----
1     fighting
2     yelling
3     cracking wise

'Actions'
id    person    act
--    ------    ---
1     1         2
2     3         2
3     2         3


The third table represents a many-many table relating the first two
tables. Assuming the foreign key constraints are correct in the models,
the admin interface will cleverly show the human-readable description,
rather than the meaningless primary key. In the case of the first two
tables, clearly the best representations would be self.name and
self.description. The third case is less clear. What I would like to do
is-

 return '%s - %s' % (person.name,activity.description)

Alas, if that was possible, I would not be bringing this up. My only
idea turned out to involve circular imports, so I am unable find a
solution to this problem. Is there a correct way to achieve this?

Reply via email to