Ticket #15669: 01.diff

File 01.diff, 2.7 KB (added by lamby, 4 years ago)
  • django/contrib/admin/validation.py

    diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py
    index 159afa4..8af7728 100644
    a b def validate(cls, model): 
    7777                field = opts.get_field_by_name(field_name)[0]
    7878            except models.FieldDoesNotExist:
    7979                raise ImproperlyConfigured("'%s.list_editable[%d]' refers to a "
    80                     "field, '%s', not defined on %s."
    81                     % (cls.__name__, idx, field_name, model.__name__))
     80                    "field, '%s', not defined on %s.%s."
     81                    % (cls.__name__, idx, field_name, model._meta.app_label, model.__name__))
    8282            if field_name not in cls.list_display:
    8383                raise ImproperlyConfigured("'%s.list_editable[%d]' refers to "
    8484                    "'%s' which is not defined in 'list_display'."
    def validate_inline(cls, parent, parent_model): 
    188188        if fk and fk.name in cls.exclude:
    189189            raise ImproperlyConfigured("%s cannot exclude the field "
    190190                    "'%s' - this is the foreign key to the parent model "
    191                     "%s." % (cls.__name__, fk.name, parent_model.__name__))
     191                    "%s.%s." % (cls.__name__, fk.name, parent_model._meta.app_label, parent_model.__name__))
    192192
    193193    if hasattr(cls, "readonly_fields"):
    194194        check_readonly_fields(cls, cls.model, cls.model._meta)
    def get_field(cls, model, opts, label, field): 
    350350    try:
    351351        return opts.get_field(field)
    352352    except models.FieldDoesNotExist:
    353         raise ImproperlyConfigured("'%s.%s' refers to field '%s' that is missing from model '%s'."
    354                 % (cls.__name__, label, field, model.__name__))
     353        raise ImproperlyConfigured("'%s.%s' refers to field '%s' that is missing from model '%s.%s'."
     354                % (cls.__name__, label, field, model._meta.app_label, model.__name__))
    355355
    356356def check_formfield(cls, model, opts, label, field):
    357357    if getattr(cls.form, 'base_fields', None):
    def fetch_attr(cls, model, opts, label, field): 
    376376    try:
    377377        return getattr(model, field)
    378378    except AttributeError:
    379         raise ImproperlyConfigured("'%s.%s' refers to '%s' that is neither a field, method or property of model '%s'."
    380             % (cls.__name__, label, field, model.__name__))
     379        raise ImproperlyConfigured("'%s.%s' refers to '%s' that is neither a field, method or property of model '%s.%s'."
     380            % (cls.__name__, label, field, model._meta.app_label, model.__name__))
    381381
    382382def check_readonly_fields(cls, model, opts):
    383383    check_isseq(cls, "readonly_fields", cls.readonly_fields)
Back to Top