Used model's Options.label/label_lower where applicable.
This commit is contained in:
parent
a45c8d7ad0
commit
b7a3a6c9ef
|
@ -607,8 +607,9 @@ class BaseModelAdminChecks:
|
||||||
except FieldDoesNotExist:
|
except FieldDoesNotExist:
|
||||||
return [
|
return [
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The value of '%s' is not a callable, an attribute of '%s', or an attribute of '%s.%s'." % (
|
"The value of '%s' is not a callable, an attribute of "
|
||||||
label, obj.__class__.__name__, obj.model._meta.app_label, obj.model._meta.object_name
|
"'%s', or an attribute of '%s'." % (
|
||||||
|
label, obj.__class__.__name__, obj.model._meta.label,
|
||||||
),
|
),
|
||||||
obj=obj.__class__,
|
obj=obj.__class__,
|
||||||
id='admin.E035',
|
id='admin.E035',
|
||||||
|
@ -731,9 +732,9 @@ class ModelAdminChecks(BaseModelAdminChecks):
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The value of '%s' refers to '%s', which is not a "
|
"The value of '%s' refers to '%s', which is not a "
|
||||||
"callable, an attribute of '%s', or an attribute or "
|
"callable, an attribute of '%s', or an attribute or "
|
||||||
"method on '%s.%s'." % (
|
"method on '%s'." % (
|
||||||
label, item, obj.__class__.__name__,
|
label, item, obj.__class__.__name__,
|
||||||
obj.model._meta.app_label, obj.model._meta.object_name,
|
obj.model._meta.label,
|
||||||
),
|
),
|
||||||
obj=obj.__class__,
|
obj=obj.__class__,
|
||||||
id='admin.E108',
|
id='admin.E108',
|
||||||
|
@ -1035,8 +1036,8 @@ class InlineModelAdminChecks(BaseModelAdminChecks):
|
||||||
return [
|
return [
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"Cannot exclude the field '%s', because it is the foreign key "
|
"Cannot exclude the field '%s', because it is the foreign key "
|
||||||
"to the parent model '%s.%s'." % (
|
"to the parent model '%s'." % (
|
||||||
fk.name, parent_model._meta.app_label, parent_model._meta.object_name
|
fk.name, parent_model._meta.label,
|
||||||
),
|
),
|
||||||
obj=obj.__class__,
|
obj=obj.__class__,
|
||||||
id='admin.E201',
|
id='admin.E201',
|
||||||
|
@ -1113,9 +1114,8 @@ def must_inherit_from(parent, option, obj, id):
|
||||||
def refer_to_missing_field(field, option, obj, id):
|
def refer_to_missing_field(field, option, obj, id):
|
||||||
return [
|
return [
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The value of '%s' refers to '%s', which is not an attribute of '%s.%s'." % (
|
"The value of '%s' refers to '%s', which is not an attribute of "
|
||||||
option, field, obj.model._meta.app_label, obj.model._meta.object_name
|
"'%s'." % (option, field, obj.model._meta.label),
|
||||||
),
|
|
||||||
obj=obj.__class__,
|
obj=obj.__class__,
|
||||||
id=id,
|
id=id,
|
||||||
),
|
),
|
||||||
|
|
|
@ -307,7 +307,7 @@ class ModelDetailView(BaseAdminDocsView):
|
||||||
})
|
})
|
||||||
return super().get_context_data(**{
|
return super().get_context_data(**{
|
||||||
**kwargs,
|
**kwargs,
|
||||||
'name': '%s.%s' % (opts.app_label, opts.object_name),
|
'name': opts.label,
|
||||||
'summary': title,
|
'summary': title,
|
||||||
'description': body,
|
'description': body,
|
||||||
'fields': fields,
|
'fields': fields,
|
||||||
|
|
|
@ -119,9 +119,10 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
)
|
)
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The verbose_name of model '%s.%s' must be at most %d characters "
|
"The verbose_name of model '%s' must be at most %d "
|
||||||
"for its builtin permission names to be at most %d characters." % (
|
"characters for its builtin permission names to be at "
|
||||||
opts.app_label, opts.object_name, verbose_name_max_length, permission_name_max_length
|
"most %d characters." % (
|
||||||
|
opts.label, verbose_name_max_length, permission_name_max_length
|
||||||
),
|
),
|
||||||
obj=model,
|
obj=model,
|
||||||
id='auth.E007',
|
id='auth.E007',
|
||||||
|
@ -138,11 +139,10 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
)
|
)
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The name of model '%s.%s' must be at most %d characters "
|
"The name of model '%s' must be at most %d characters "
|
||||||
"for its builtin permission codenames to be at most %d "
|
"for its builtin permission codenames to be at most %d "
|
||||||
"characters." % (
|
"characters." % (
|
||||||
opts.app_label,
|
opts.label,
|
||||||
opts.object_name,
|
|
||||||
model_name_max_length,
|
model_name_max_length,
|
||||||
permission_codename_max_length,
|
permission_codename_max_length,
|
||||||
),
|
),
|
||||||
|
@ -156,8 +156,9 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
if len(name) > permission_name_max_length:
|
if len(name) > permission_name_max_length:
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The permission named '%s' of model '%s.%s' is longer than %d characters." % (
|
"The permission named '%s' of model '%s' is longer "
|
||||||
name, opts.app_label, opts.object_name, permission_name_max_length
|
"than %d characters." % (
|
||||||
|
name, opts.label, permission_name_max_length,
|
||||||
),
|
),
|
||||||
obj=model,
|
obj=model,
|
||||||
id='auth.E008',
|
id='auth.E008',
|
||||||
|
@ -167,11 +168,10 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
if len(codename) > permission_codename_max_length:
|
if len(codename) > permission_codename_max_length:
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The permission codenamed '%s' of model '%s.%s' is "
|
"The permission codenamed '%s' of model '%s' is "
|
||||||
"longer than %d characters." % (
|
"longer than %d characters." % (
|
||||||
codename,
|
codename,
|
||||||
opts.app_label,
|
opts.label,
|
||||||
opts.object_name,
|
|
||||||
permission_codename_max_length,
|
permission_codename_max_length,
|
||||||
),
|
),
|
||||||
obj=model,
|
obj=model,
|
||||||
|
@ -183,9 +183,7 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The permission codenamed '%s' clashes with a builtin permission "
|
"The permission codenamed '%s' clashes with a builtin permission "
|
||||||
"for model '%s.%s'." % (
|
"for model '%s'." % (codename, opts.label),
|
||||||
codename, opts.app_label, opts.object_name
|
|
||||||
),
|
|
||||||
obj=model,
|
obj=model,
|
||||||
id='auth.E005',
|
id='auth.E005',
|
||||||
)
|
)
|
||||||
|
@ -193,9 +191,8 @@ def check_models_permissions(app_configs=None, **kwargs):
|
||||||
elif codename in codenames:
|
elif codename in codenames:
|
||||||
errors.append(
|
errors.append(
|
||||||
checks.Error(
|
checks.Error(
|
||||||
"The permission codenamed '%s' is duplicated for model '%s.%s'." % (
|
"The permission codenamed '%s' is duplicated for "
|
||||||
codename, opts.app_label, opts.object_name
|
"model '%s'." % (codename, opts.label),
|
||||||
),
|
|
||||||
obj=model,
|
obj=model,
|
||||||
id='auth.E006',
|
id='auth.E006',
|
||||||
)
|
)
|
||||||
|
|
|
@ -225,7 +225,7 @@ def sort_dependencies(app_list):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Can't resolve dependencies for %s in serialized app list." %
|
"Can't resolve dependencies for %s in serialized app list." %
|
||||||
', '.join(
|
', '.join(
|
||||||
'%s.%s' % (model._meta.app_label, model._meta.object_name)
|
model._meta.label
|
||||||
for model, deps in sorted(skipped, key=lambda obj: obj[0].__name__)
|
for model, deps in sorted(skipped, key=lambda obj: obj[0].__name__)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -307,7 +307,7 @@ class Options:
|
||||||
return '<Options for %s>' % self.object_name
|
return '<Options for %s>' % self.object_name
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s.%s" % (self.app_label, self.model_name)
|
return self.label_lower
|
||||||
|
|
||||||
def can_migrate(self, connection):
|
def can_migrate(self, connection):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue