I'm trying to get a very simple relationship to work but I can't figure ou how to do this in Django. This is what I want.
Poll ---<< question Poll ---<< vote A user can vote a poll just once. I check this using a function which gets the remote ip. This is the models.py snippet class Poll(models.Model): question = models.CharField('vraag', maxlength=200) pub_date = models.DateTimeField('publicatie datum') def has_remote_addr_voted(self, ip): result = False if (self.vote_set.filter(voter_ip = ip).count() > 0): result = True return result class Admin: fields = ( (None, {'fields': ('question','pub_date',)}), ) pass class Choice(models.Model): poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, num_in_admin=3) choice = models.CharField(maxlength=200, core=True) votes = models.IntegerField(core=True) class Vote(models.Model): poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, num_in_admin=3) voter_ip = models.IPAddressField(core=True) choice = models.ForeignKey(Choice, edit_inline=models.TABULAR, num_in_admin=3) class Meta: unique_together = (("poll", "voter_ip"),) The model is correct but the problem occurs in admin. Editing a poll you get the related choices and votes. For a vote you can select a choice from a list which contains all choices, not the choices for the current poll. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---