title: Django time difference with F object
body: <p>I have the following model:</p>
  
  <pre><code>class Assignment(models.Model):
    extra_days = models.IntegerField(default=0)
    due_date = models.DateTimeField()
  </code></pre>
  
  <p>Where <code>due_date</code> is the date the assignment is due and <code>extra_days</code> is the number of extra days given after the due date to finish the assignment.</p>
  
  <p>I want to create a query that returns all rows where <code>due_date + extra_days</code> is greater than the current date.  Here's what I am doing:</p>
  
  <pre><code>from django.utils import timezone
  from django.db.models import F
  from datetime import datetime
  
  cur_date = timezone.make_aware(datetime.now(), timezone.get_default_timezone())
  a = Assignment.objects.filter(extra_days__gt=cur_date - F('due_date'))
  </code></pre>
  
  <p>When I print <code>a</code>, I get the following error:</p>
  
  <pre><code>  File "c:\Python27\lib\site-packages\MySQLdb\cursors.py", line 204, in execute
      if not self._defer_warnings: self._warning_check()
    File "c:\Python27\lib\site-packages\MySQLdb\cursors.py", line 117, in _warning
  _check
      warn(w[-1], self.Warning, 3)
  Warning: Truncated incorrect DOUBLE value: '2013-09-01 02:54:31'
  </code></pre>
  
  <p>If I do a time difference that results in, say, 3.1 days, I'm assuming the days difference would be still be 3.  I think it would more correct to do something like this:</p>
  
  <pre><code>a = Assignment.objects.filter(due_date__gt=cur_date - timedelta(days=F('extra_days')))
  </code></pre>
  
  <p>But that also results in an error.</p>
  
  <p>How can I do this without writing a raw SQL query?</p>