Django

Code

Changeset 5016

Show
Ignore:
Timestamp:
04/17/07 02:08:42 (2 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/databrowse/datastructures.py

    r5015 r5016  
    88from django.utils.text import capfirst 
    99from django.utils.translation import get_date_formats 
     10 
     11EMPTY_VALUE = '(None)' 
    1012 
    1113class EasyModel(object): 
     
    135137        # some settings to be imported, and we don't want to do that at the 
    136138        # module level. 
    137         from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE 
    138139        if self.field.rel: 
    139140            if isinstance(self.field.rel, models.ManyToOneRel): 
     
    142143                return list(getattr(self.instance.instance, self.field.name).all()) 
    143144        elif self.field.choices: 
    144             objs = dict(self.field.choices).get(self.raw_value, EMPTY_CHANGELIST_VALUE) 
     145            objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE) 
    145146        elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField): 
    146147            if self.raw_value: 
     
    153154                    objs = capfirst(dateformat.format(self.raw_value, date_format)) 
    154155            else: 
    155                 objs = EMPTY_CHANGELIST_VALUE 
     156                objs = EMPTY_VALUE 
    156157        elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField): 
    157158            objs = {True: 'Yes', False: 'No', None: 'Unknown'}[self.raw_value]