Changeset 9002
- Timestamp:
- 09/10/08 01:06:04 (4 months ago)
- Files:
-
- django/trunk/django/contrib/admin/validation.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/admin/validation.py
r8662 r9002 121 121 # model is already verified to exist and be a Model 122 122 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) 125 124 if not isinstance(f, models.ForeignKey): 126 125 raise ImproperlyConfigured("'%s.fk_name is not an instance of " … … 230 229 check_isseq(cls, "prepopulated_fields['%s']" % field, val) 231 230 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) 235 232 236 233 def check_isseq(cls, label, obj): 237 234 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)) 240 236 241 237 def check_isdict(cls, label, obj): 242 238 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)) 245 240 246 241 def get_field(cls, model, opts, label, field):
