I think the solution to this might actually be very simple . I have an
app stories that looks something like this at the moment . It is in
the same file ideally i would like if both of them were related by
foreignkey but that is not possible because they are in same file and
there are declaration issues(NameError).

class Story(models.Model):
    """Story model."""

    author = models.ForeignKey(User, blank=True, null=True)
    title = models.TextField(_('title'), )


class Vote(models.Model):
    """
    A vote on an story by a User.
    """
    user = models.ForeignKey(User)
    story = models.ForeignKey(Story)
    votes = models.SmallIntegerField(default=0)

if i make a foreignkey in story , I have to write a very complicated
query to ensure no user can vote twice.  In case I keep it in vote its
incredibly complicated to write a query to get the score for a story
and order stories by vote what should i do .


Thanks
Amit

-- 
A-M-I-T S|S

-- 
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