magic-removal: Changed Options.__repr__ to use object_name, not module_name (which is going away)
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fd44a02a1a
commit
40d4782263
|
@ -50,7 +50,7 @@ class Options:
|
||||||
def contribute_to_class(self, cls, name):
|
def contribute_to_class(self, cls, name):
|
||||||
cls._meta = self
|
cls._meta = self
|
||||||
self.object_name = cls.__name__
|
self.object_name = cls.__name__
|
||||||
self.module_name = get_module_name(self.object_name )
|
self.module_name = get_module_name(self.object_name)
|
||||||
# If the verbose_name wasn't given, use the class name,
|
# If the verbose_name wasn't given, use the class name,
|
||||||
# converted from "InitialCaps" to "lowercase with spaces".
|
# converted from "InitialCaps" to "lowercase with spaces".
|
||||||
self.verbose_name = get_verbose_name(self.object_name)
|
self.verbose_name = get_verbose_name(self.object_name)
|
||||||
|
@ -89,7 +89,7 @@ class Options:
|
||||||
self.pk = field
|
self.pk = field
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Options for %s>' % self.module_name
|
return '<Options for %s>' % self.object_name
|
||||||
|
|
||||||
def get_content_type_id(self):
|
def get_content_type_id(self):
|
||||||
"Returns the content-type ID for this object type."
|
"Returns the content-type ID for this object type."
|
||||||
|
@ -101,9 +101,7 @@ class Options:
|
||||||
return self._content_type_id
|
return self._content_type_id
|
||||||
|
|
||||||
def get_field(self, name, many_to_many=True):
|
def get_field(self, name, many_to_many=True):
|
||||||
"""
|
"Returns the requested field by name. Raises FieldDoesNotExist on error."
|
||||||
Returns the requested field by name. Raises FieldDoesNotExist on error.
|
|
||||||
"""
|
|
||||||
to_search = many_to_many and (self.fields + self.many_to_many) or self.fields
|
to_search = many_to_many and (self.fields + self.many_to_many) or self.fields
|
||||||
for f in to_search:
|
for f in to_search:
|
||||||
if f.name == name:
|
if f.name == name:
|
||||||
|
|
Loading…
Reference in New Issue