diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-01-29 01:03:55 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-01-29 01:03:55 +0000 |
| commit | 126c6cef5227ae91c2c3ea92eba220735e1bc411 (patch) | |
| tree | 719d8b952fda2e8d2b6558c4ba55fdec7a2c9d75 /django/core | |
| parent | 54d2c5442562e30b2d293de6d0fd12f5d75f8b87 (diff) | |
newforms-admin: Backwards-incompatible change: Refactored prepopulate_from. There's no longer a 'prepopulate_from' option on database Field classes. Instead, there's a new 'prepopulated_fields' option on the 'class Admin'. This should be a dictionary mapping field names (as strings) to lists/tuples of field names that prepopulate them
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4446 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/core/management.py b/django/core/management.py index 885a1c10bc..74e8016fc8 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -891,8 +891,6 @@ def get_validation_errors(outfile, app=None): from PIL import Image except ImportError: e.add(opts, '"%s": To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .' % f.name) - if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple): - e.add(opts, '"%s": prepopulate_from should be a list or tuple.' % f.name) if f.choices: if not hasattr(f.choices, '__iter__'): e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name) @@ -979,6 +977,14 @@ def get_validation_errors(outfile, app=None): # Check admin attribute. if opts.admin is not None: + # prepopulated_fields + if not isinstance(opts.admin.prepopulated_fields, dict): + e.add(opts, '"%s": prepopulated_fields should be a dictionary.' % f.name) + else: + for field_name, field_list in opts.admin.prepopulated_fields.items(): + if not isinstance(field_list, (list, tuple)): + e.add(opts, '"%s": prepopulated_fields "%s" value should be a list or tuple.' % (f.name, field_name)) + # list_display if not isinstance(opts.admin.list_display, (list, tuple)): e.add(opts, '"admin.list_display", if given, must be set to a list or tuple.') |
