﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23940	"ORM should allow model fields named ""exact"""	zhiyajun11	Simon Charette <charette.s@…>	"Hi guys, when i try to access the related model of a model who has a field named exact by related-manager, a 'exact=true' limit will be add to the sql automatically. As show below:

My models is:
{{{
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.

class Question(models.Model):
    question_text = models.CharField(max_length=200)
    #pub_date = models.DateTimeField('date published')
    pub_date = models.IntegerField()
    exact = models.NullBooleanField() 
    #exact = models.IntegerField(default=0)
    def was_published_recently(self):
        return self.pub_date >= timezone.now() - datetime.timedelta(days=1)


class Choice(models.Model):
    question = models.ForeignKey(Question, related_name = 'choices')
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)
}}}

The shell command is:
{{{
In [1]: from polls.models import Question
 
In [2]: Question.objects.all()
Out[2]: [<Question: Question object>, <Question: Question object>]
 
In [3]: q = Question.objects.get(pk=1)
 
In [4]: q
Out[4]: <Question: Question object>
 
In [5]: q.choices.all()
Out[5]: []
 
In [6]: from django.db import connection
 
In [7]: connection.queries[-1]
Out[7]:
{u'sql': u'QUERY = u'SELECT ""polls_choice"".""id"", ""polls_choice"".""question_id"", ""polls_choice"".""choice_text"", ""polls_choice"".""votes"" FROM ""polls_choice"" INNER JOIN ""polls_question"" ON ( ""polls_choice"".""question_id"" = ""polls_question"".""id"" ) WHERE ""polls_question"".""exact"" = %s LIMIT 21' - PARAMS = (True,)',
u'time': u'0.000'}
}}}

Ps: this problem also show up on django1.6."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		zhiyajun11 Yuki Izumi info+coding@…	Ready for checkin	1	0	0	0	0	0
