I found a solution using a custom query in models.py
def get_unvoted_polls_for_voter_ip(ip):
from django.db import connection
cursor = connection.cursor()
sql = """SELECT polls_poll.id, polls_poll.question FROM polls_poll
LEFT OUTER JOIN polls_vote ON polls_poll.id = polls_vote.poll_id
WHERE polls_vote.voter_ip <> '%s' OR polls_vote.voter_ip IS
NULL;""" % ip
cursor.execute(sql)
list = cursor.fetchall()
return list
Now I want to create poll objects from the result but I dont know how.
Any idea?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---