Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 4, 2011 10:37:45

Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problem with models

I have model of text, like that:

class Text(models.Model):
text = models.CharField()
user = models.ForeignKey(User) #author

And i need to compare two of texts, so i need table like this:

class Compare(models.Model):
text1 = models.ForeignKey(Text)
text2 = models.ForeignKey(Text)
user = models.ForeignKey(User) #who compared

Now i want to get from Text table two random texts and at least one of
them cant be compared yet by given user, how can i do this?

if I try reverse relation compares_set, it doesnt work cause' i have
two foreignkey of same model.
I cant give manaytomanyfield in Text through Compare because i cant
make symmetrical reference with intermediate table.

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


Board footer

Moderator control

Enjoy the 24th of March

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support