Friday, May 28, 2010

ManyToMany + through model disappear from Admin interface

Hello,
I have this simple code, which dives me crazy already :(

class ActiveInformer(models.Model):
informer = models.ForeignKey('Informer',
related_name='act_informers')
user = models.ForeignKey(User, related_name='informers')

class Informer(models.Model):
informer_types = (('P', 'Poll'),
('I', 'Info'),
)
Name = models.CharField(max_length=50)
Type = models.CharField(default = 'I', max_length=1", choices =
informer_types)
Active = models.BooleanField(default=False,')
ActiveFor = models.ManyToManyField(User, through=ActiveInformer)

class User(models.Model):
...

The issue is, when I avoid "through=ActiveInformer" parameter, I can
see list of Users on Admin interface (when Django create it's own
table for ManyToMany relation). As soon as I add "throught=", related
Users disappear from list of shown Informer parameters on Admin
interface.
How to overcome this? What I'm doing wrong?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment