Django

Code

Changeset 9002

Show
Ignore:
Timestamp:
09/10/08 01:06:04 (4 months ago)
Author:
adrian
Message:

Fixed #8957 -- Fixed incorrect error message when Admin prepopulated_fields refers to a field that does not exist. Thanks, charmless

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/admin/validation.py

    r8662 r9002  
    121121    # model is already verified to exist and be a Model 
    122122    if cls.fk_name: # default value is None 
    123         f = get_field(cls, cls.model, cls.model._meta, 
    124                 'fk_name', cls.fk_name) 
     123        f = get_field(cls, cls.model, cls.model._meta, 'fk_name', cls.fk_name) 
    125124        if not isinstance(f, models.ForeignKey): 
    126125            raise ImproperlyConfigured("'%s.fk_name is not an instance of " 
     
    230229            check_isseq(cls, "prepopulated_fields['%s']" % field, val) 
    231230            for idx, f in enumerate(val): 
    232                 get_field(cls, model, 
    233                         opts, "prepopulated_fields['%s'][%d]" 
    234                         % (f, idx), f) 
     231                get_field(cls, model, opts, "prepopulated_fields['%s'][%d]" % (field, idx), f) 
    235232 
    236233def check_isseq(cls, label, obj): 
    237234    if not isinstance(obj, (list, tuple)): 
    238         raise ImproperlyConfigured("'%s.%s' must be a list or tuple." 
    239                 % (cls.__name__, label)) 
     235        raise ImproperlyConfigured("'%s.%s' must be a list or tuple." % (cls.__name__, label)) 
    240236 
    241237def check_isdict(cls, label, obj): 
    242238    if not isinstance(obj, dict): 
    243         raise ImproperlyConfigured("'%s.%s' must be a dictionary." 
    244                 % (cls.__name__, label)) 
     239        raise ImproperlyConfigured("'%s.%s' must be a dictionary." % (cls.__name__, label)) 
    245240 
    246241def get_field(cls, model, opts, label, field):