Hi,
I am pretty new to django and python as well. I am working on my first
django project and trying to find the best approch to solve the following
issue :
On my project I do have a voting system. the votes are for a specific item.
Each user can vote once per item.
What I am trying to do is that a user can see all of the items he can vote
excluding the ones he already voted on.
here are the models for an example :
class Item(models.Model) :
user_owner = models.ForeignKey(UserProfile)
item_notes = models.CharField(max_length=500);
added = models.DateField()
class Vote(models.Model) :
item= models.ForeignKey(item)
user = models.ForeignKey(UserProfile)
notes = models.CharField(max_length=500);
score = models.IntegerField()
added = models.DateField();
The first filtering I am doing is to take away any items that are owned by
the specific user. So I am doing the following :
items = item.objects.exclude(user_owner = profile)
On those items I now want to retrieve only the items that were not voted yet
by the specific user. My problem here is that I cant use the objects.exclude
because I want a specific entry on the item tabe to be compared with all the
votes realted to the user.
Any django way to do this ? or should I just use a for loop here ?
Thanks in advance,
Elad
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---