title: Django error in filtering datetime field by date : Join on field X not permitted
body: <p>I saw another post suggests that datetime field can be filtered by time, by using <code>__date</code>. However when I tried on my machine it never worked.</p>
  
  <p>This is my <code>models.py</code></p>
  
  <pre><code>class Record (models.Model):
      time = models.DateTimeField(null=True,blank=True)
      user = ForeignKey to the user table
      content = models.CharField(max_length=36,null=True,blank=True,unique=True)
  </code></pre>
  
  <p>In <code>python manage.py.runserver</code></p>
  
  <pre><code>&gt;&gt;&gt; from datetime import datetime
  &gt;&gt;&gt; from appname.models import Record
  
  &gt;&gt;&gt; u = User.objects.filter(username = 'user')
  &gt;&gt;&gt; r = Record.objects.filter(time__date = datetime.today().date())
  
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "C:\Python27\lib\site-packages\django\db\models\manager.py", line 163, in filter
      return self.get_queryset().filter(*args, **kwargs)
    File "C:\Python27\lib\site-packages\django\db\models\query.py", line 590, in filter
      return self._filter_or_exclude(False, *args, **kwargs)
    File "C:\Python27\lib\site-packages\django\db\models\query.py", line 608, in _filter_or_exclude
      clone.query.add_q(Q(*args, **kwargs))
    File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line 1198, in add_q
      clause = self._add_q(where_part, used_aliases)
    File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line 1234, in _add_q
      current_negated=current_negated)
    File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line 1100, in build_filter
      allow_explicit_fk=True)
    File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line 1357, in setup_joins
      names, opts, allow_many, allow_explicit_fk)
    File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line 1320, in names_to_path
  
      "the lookup type?" % (name, names[pos + 1]))
  FieldError: Join on field 'timeIn' not permitted. Did you misspell 'date' for the lookup type?
  </code></pre>
  
  <p>I am on windows 7 running python 2.7, django 1.6</p>
  
  <p>Any help is greatly appreciated!</p>