Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replaced Options.object_name.lower() by Options.model_name.

Thanks Simon for the suggestion.

Also removed inappropriate lowercasing of app labels in migrations.
Unlike model names, they are case sensitive.
  • Loading branch information...
commit 20d487c27b40bb70496ddc7419011ca78b7d4940 1 parent 308960b
@aaugustin aaugustin authored
View
2  django/contrib/admin/templates/admin/auth/user/change_password.html
@@ -6,7 +6,7 @@
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endblock %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
-{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
+{% block bodyclass %}{{ opts.app_label }}-{{ opts.model_name }} change-form{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
View
2  django/contrib/admin/templates/admin/change_form.html
@@ -10,7 +10,7 @@
{% block coltype %}colM{% endblock %}
-{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.object_name.lower }} change-form{% endblock %}
+{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
View
2  django/contrib/admin/templates/admin/change_list.html
@@ -32,7 +32,7 @@
{% endif %}{% endif %}
{% endblock %}
-{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.object_name.lower }} change-list{% endblock %}
+{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
View
2  django/contrib/admin/templates/admin/delete_confirmation.html
@@ -1,7 +1,7 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls %}
-{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.object_name.lower }} delete-confirmation{% endblock %}
+{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
View
2  django/contrib/admin/templates/admin/delete_selected_confirmation.html
@@ -1,7 +1,7 @@
{% extends "admin/base_site.html" %}
{% load i18n l10n admin_urls %}
-{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.object_name.lower }} delete-confirmation delete-selected-confirmation{% endblock %}
+{% block bodyclass %}app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
View
2  django/contrib/admindocs/templates/admin_doc/model_index.html
@@ -27,7 +27,7 @@ <h2 id="app-{{ group.grouper }}">{{ group.grouper|capfirst }}</h2>
<table class="xfull">
{% for model in group.list %}
<tr>
-<th><a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.object_name.lower %}">{{ model.object_name }}</a></th>
+<th><a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.model_name %}">{{ model.object_name }}</a></th>
</tr>
{% endfor %}
</table>
View
4 django/db/migrations/autodetector.py
@@ -71,9 +71,9 @@ def _detect_changes(self):
for field in new_apps.get_model(app_label, model_name)._meta.local_fields:
if field.rel:
if field.rel.to:
- related_fields.append((field.name, field.rel.to._meta.app_label.lower(), field.rel.to._meta.object_name.lower()))
+ related_fields.append((field.name, field.rel.to._meta.app_label, field.rel.to._meta.model_name))
if hasattr(field.rel, "through") and not field.rel.though._meta.auto_created:
- related_fields.append((field.name, field.rel.through._meta.app_label.lower(), field.rel.through._meta.object_name.lower()))
+ related_fields.append((field.name, field.rel.through._meta.app_label, field.rel.through._meta.model_name))
if related_fields:
pending_add[app_label, model_name] = related_fields
else:
View
2  django/db/migrations/state.py
@@ -152,7 +152,7 @@ def from_model(cls, model):
options[name] = model._meta.original_attrs[name]
# Make our record
bases = tuple(
- ("%s.%s" % (base._meta.app_label, base._meta.object_name.lower()) if hasattr(base, "_meta") else base)
+ ("%s.%s" % (base._meta.app_label, base._meta.model_name) if hasattr(base, "_meta") else base)
for base in model.__bases__
if (not hasattr(base, "_meta") or not base._meta.abstract)
)
View
2  django/db/models/fields/related.py
@@ -1278,7 +1278,7 @@ class ForeignKey(ForeignObject):
def __init__(self, to, to_field=None, rel_class=ManyToOneRel,
db_constraint=True, **kwargs):
try:
- to._meta.object_name.lower()
+ to._meta.model_name
except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT
assert isinstance(to, six.string_types), "%s(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (self.__class__.__name__, to, RECURSIVE_RELATIONSHIP_CONSTANT)
else:
Please sign in to comment.
Something went wrong with that request. Please try again.