Author: adrian
Date: 2007-04-17 02:08:42 -0500 (Tue, 17 Apr 2007)
New Revision: 5016
Modified:
django/trunk/django/contrib/databrowse/datastructures.py
Log:
Fixed #4060 -- Databrowse no longer requires admin site to be installed
Modified: django/trunk/django/contrib/databrowse/datastructures.py
===================================================================
--- django/trunk/django/contrib/databrowse/datastructures.py 2007-04-17
00:40:11 UTC (rev 5015)
+++ django/trunk/django/contrib/databrowse/datastructures.py 2007-04-17
07:08:42 UTC (rev 5016)
@@ -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 @@
# 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 @@
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:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---