Fixed #4058 -- Fixed AttributeError in databrowse with USE_I18N=True

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-04-17 00:40:11 +00:00
parent 3b55c34704
commit 968a0627d9
1 changed files with 4 additions and 1 deletions

View File

@ -3,7 +3,6 @@ These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app. convenience functionality and permalink functions for the databrowse app.
""" """
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
from django.db import models from django.db import models
from django.utils import dateformat from django.utils import dateformat
from django.utils.text import capfirst from django.utils.text import capfirst
@ -132,6 +131,10 @@ class EasyInstanceField(object):
Returns a list of values for this field for this instance. It's a list Returns a list of values for this field for this instance. It's a list
so we can accomodate many-to-many fields. so we can accomodate many-to-many fields.
""" """
# This import is deliberately inside the function because it causes
# some settings to be imported, and we don't want to do that at the
# module level.
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
if self.field.rel: if self.field.rel:
if isinstance(self.field.rel, models.ManyToOneRel): if isinstance(self.field.rel, models.ManyToOneRel):
objs = getattr(self.instance.instance, self.field.name) objs = getattr(self.instance.instance, self.field.name)