Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4060 -- Databrowse no longer requires admin site to be installed

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5016 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c64f7f065a13876901fffa6249667e865d33fd9a 1 parent 968a062
@adrianholovaty adrianholovaty authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 django/contrib/databrowse/datastructures.py
View
7 django/contrib/databrowse/datastructures.py
@@ -8,6 +8,8 @@
from django.utils.text import capfirst
from django.utils.translation import get_date_formats
+EMPTY_VALUE = '(None)'
+
class EasyModel(object):
def __init__(self, site, model):
self.site = site
@@ -134,14 +136,13 @@ def values(self):
# 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 isinstance(self.field.rel, models.ManyToOneRel):
objs = getattr(self.instance.instance, self.field.name)
elif isinstance(self.field.rel, models.ManyToManyRel): # ManyToManyRel
return list(getattr(self.instance.instance, self.field.name).all())
elif self.field.choices:
- objs = dict(self.field.choices).get(self.raw_value, EMPTY_CHANGELIST_VALUE)
+ objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE)
elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField):
if self.raw_value:
date_format, datetime_format, time_format = get_date_formats()
@@ -152,7 +153,7 @@ def values(self):
else:
objs = capfirst(dateformat.format(self.raw_value, date_format))
else:
- objs = EMPTY_CHANGELIST_VALUE
+ objs = EMPTY_VALUE
elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField):
objs = {True: 'Yes', False: 'No', None: 'Unknown'}[self.raw_value]
else:
Please sign in to comment.
Something went wrong with that request. Please try again.