﻿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
7199	Admin Page Not Listing Objects	hickswright+django@…	nobody	"Environment:

Request Method: GET
Request URL: ***********************
Django Version: 0.97-pre-SVN-unknown
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.markup',
 'django.contrib.humanize',
 'django.contrib.redirects',
 ...]
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.contrib.redirects.middleware.RedirectFallbackMiddleware')


Template error:
In template /usr/lib/python2.5/site-packages/django/contrib/admin/templates/admin/change_list.html, error at line 16
   Caught an exception while rendering: invalid literal for int() with base 10: 'None'
   6 : {% block coltype %}flex{% endblock %}


   7 : {% block content %}


   8 : <div id=""content-main"">


   9 : {% block object-tools %}


   10 : {% if has_add_permission %}


   11 : <ul class=""object-tools""><li><a href=""add/{% if is_popup %}?_popup=1{% endif %}"" class=""addlink"">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul>


   12 : {% endif %}


   13 : {% endblock %}


   14 : <div class=""module{% if cl.has_filters %} filtered{% endif %}"" id=""changelist"">


   15 : {% block search %}{% search_form cl %}{% endblock %}


   16 : {% block date_hierarchy %} {% date_hierarchy cl %} {% endblock %}


   17 : {% block filters %}{% filters cl %}{% endblock %}


   18 : {% block result_list %}{% result_list cl %}{% endblock %}


   19 : {% block pagination %}{% pagination cl %}{% endblock %}


   20 : </div>


   21 : </div>


   22 : {% endblock %}


   23 : 

Traceback:
File ""/usr/lib/python2.5/site-packages/django/template/debug.py"" in render_node
  71.             result = node.render(context)
File ""/usr/lib/python2.5/site-packages/django/template/__init__.py"" in render
  898.                     dict = func(*args)
File ""/usr/lib/python2.5/site-packages/django/contrib/admin/templatetags/admin_list.py"" in date_hierarchy
  271.                 } for year in years]
File ""/usr/lib/python2.5/site-packages/django/db/models/query.py"" in _result_iter
  78.                 self._fill_cache()
File ""/usr/lib/python2.5/site-packages/django/db/models/query.py"" in _fill_cache
  490.                     self._result_cache.append(self._iter.next())
File ""/usr/lib/python2.5/site-packages/django/db/models/sql/subqueries.py"" in results_iter
  357.                     date = typecast_timestamp(str(date))
File ""/usr/lib/python2.5/site-packages/django/db/backends/util.py"" in typecast_timestamp
  67.     if not ' ' in s: return typecast_date(s)
File ""/usr/lib/python2.5/site-packages/django/db/backends/util.py"" in typecast_date
  52.     return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null

Exception Type: ValueError at /admin/blog/entry/
Exception Value: invalid literal for int() with base 10: 'None'

Looking through the code, the problem appears to be in django/db/models/sql/subqueries.py on line 357: 

date = typecast_timestamp(str(date))

If date is None, str(date) equals the string 'None', not the None object, which results in the tests for None in typecast_date() (django/db/backends/util.py:52) to not work properly.  It seems that the test needs to be moved up into django/db/models/sql/subqueries.py."		closed	Database layer (models, ORM)	dev		duplicate	qsrf-cleanup		Accepted	0	0	0	0	0	0
