~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/contrib/admin/validation.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from django.contrib.admin import ListFilter, FieldListFilter
7
7
from django.contrib.admin.util import get_fields_from_path, NotRelationField
8
8
from django.contrib.admin.options import (flatten_fieldsets, BaseModelAdmin,
9
 
    HORIZONTAL, VERTICAL)
 
9
    ModelAdmin, HORIZONTAL, VERTICAL)
10
10
 
11
11
 
12
12
__all__ = ['validate']
388
388
            raise ImproperlyConfigured("'%s.%s' refers to field '%s' that "
389
389
                "is missing from the form." % (cls.__name__, label, field))
390
390
    else:
391
 
        fields = fields_for_model(model)
392
 
        try:
393
 
            fields[field]
394
 
        except KeyError:
395
 
            raise ImproperlyConfigured("'%s.%s' refers to field '%s' that "
396
 
                "is missing from the form." % (cls.__name__, label, field))
 
391
        get_form_is_overridden = hasattr(cls, 'get_form') and cls.get_form != ModelAdmin.get_form
 
392
        if not get_form_is_overridden:
 
393
            fields = fields_for_model(model)
 
394
            try:
 
395
                fields[field]
 
396
            except KeyError:
 
397
                raise ImproperlyConfigured("'%s.%s' refers to field '%s' that "
 
398
                    "is missing from the form." % (cls.__name__, label, field))
397
399
 
398
400
def fetch_attr(cls, model, opts, label, field):
399
401
    try: