title: Expecting expected string or bytes-like object
body: <p>I'm having an issue on my django app however, it seems to be more of a python issue, although I don't see where the issue lies</p>
  
  <p>This is my code</p>
  
  <pre><code> for q in qs:
  
          untouched_question_in_term_of_minutes = (now() - q.date) #take the current date 
          #and substract the date when the question was created
          certain_mn_ago = untouched_question_in_term_of_minutes.total_seconds() / 60 
          #that gives me the number of minutes where 
          #the question has not been touched
          limit_of_mn = 50
          print(untouched_question_in_term_of_minutes)
          print(certain_mn_ago)
  
          if certain_mn_ago &gt;= limit_of_mn: 
          #if the  condition is fulfilled, then the action below are done
              ae = AssociatedExpert.objects.filter(question=q, state='P')
              ae.update(state='C')
              Question.objects.filter(id=q.id, state='P').update(state='C')
  
              qs.filter(date__lte=certain_mn_ago, state='C').update(email='***',
                                               first_name='***',
                                               last_name='***',
                                               phone='***',
                                               extra='***')
          else:
              ae = AssociatedExpert.objects.filter(question=q,
                                                   state__in=['D', 'T', 'A',
                                                              'F']).first()
              if ae:
                  qs.filter(id=q.id).update(state=ae.state)
  </code></pre>
  
  <p>As you see, the logic seems to bere here. Yet, it is giving me the traceback below.</p>
  
  <pre><code>TypeError at /temp_app/question/
  expected string or bytes-like object
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/temp_app/question/
  Django Version: 2.0.3
  Exception Type: TypeError
  Exception Value:    
  expected string or bytes-like object
  Exception Location: 
  /home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/django/utils/dateparse.py in parse_datetime, line 107
  Python Executable:  /home/andykw/cloned_projects/findoor-backend/.venv/bin/python
  Python Version: 3.6.7
  Python Path:    
  ['/home/andykw/cloned_projects/findoor-backend/findoor_backend',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python36.zip',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/lib-dynload',
   '/usr/lib/python3.6',
   '',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages',
   '/home/andykw/cloned_projects/findoor-backend/.venv/src/django-s3-upload',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/IPython/extensions',
   '/home/andykw/.ipython',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf',
   '/home/andykw/cloned_projects/findoor-backend/.venv/lib/python3.6/site-packages/odf']
  Server time:    Thu, 25 Apr 2019 11:49:27 +0200
  </code></pre>
  
  <p>I thought about using to cast <code>untouched_question_in_term_of_minutes</code> and <code>certain_mn_ago</code> as <code>int</code> but the issue is still here.</p>
  
  <p>The funny part is when I'm using the <code>ipdb</code>, everything seems to be ok.</p>
  
  <p>If you have any ideas, I'm all ear.</p>
  
  <p><strong>update</strong> : I have found the issue. It is this <code>date__lte</code> part that is creating the problem.</p>