﻿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
17882	regressiontests.admin_filters fails with pyscopg2 when USE_TZ is False	Brodie Rao	Aymeric Augustin	"With these settings:

{{{#!python
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'djangotest',
        'USER': 'djangotest',
        'PASSWORD': 'djangotest',
    },
    'other': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'djangotestother',
        'USER': 'djangotestother',
        'PASSWORD': 'djangotestother',
    }
}

SECRET_KEY = ""django_tests_secret_key""
}}}

Running the admin_filters test from trunk (at [17682]) fails when testing time zone support:

{{{
Creating test database for alias 'default'...
Creating test database for alias 'other'...
....E...........
======================================================================
ERROR: test_datefieldlistfilter_with_time_zone_support (regressiontests.admin_filters.tests.ListFiltersTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""django/django/test/utils.py"", line 214, in inner
    return test_func(*args, **kwargs)
  File ""django/tests/regressiontests/admin_filters/tests.py"", line 227, in test_datefieldlistfilter_with_time_zone_support
    self.test_datefieldlistfilter()
  File ""django/tests/regressiontests/admin_filters/tests.py"", line 146, in test_datefieldlistfilter
    changelist = self.get_changelist(request, Book, modeladmin)
  File ""django/tests/regressiontests/admin_filters/tests.py"", line 140, in get_changelist
    modeladmin.list_select_related, modeladmin.list_per_page, modeladmin.list_max_show_all, modeladmin.list_editable, modeladmin)
  File ""django/django/contrib/admin/views/main.py"", line 70, in __init__
    self.query_set = self.get_query_set(request)
  File ""django/django/contrib/admin/views/main.py"", line 322, in get_query_set
    raise IncorrectLookupParameters(e)
IncorrectLookupParameters: database connection isn't set to UTC

----------------------------------------------------------------------
Ran 16 tests in 0.628s

FAILED (errors=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
}}}

Adding `USE_TZ = True` to the settings file makes the test pass. I suspect the test is failing because, despite it using `@override_settings(USE_TZ=True)`, the current database connection isn't set up to use time zones."	Bug	closed	Database layer (models, ORM)	dev	Release blocker	fixed		Aymeric Augustin Jannis Leidel	Accepted	1	0	0	1	0	0
