magic-removal: Small code cleanup
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
743b02825e
commit
3a2c18ac53
|
@ -76,8 +76,7 @@ class ForeignKey(SharedMethods, Field):
|
||||||
try:
|
try:
|
||||||
to_name = to._meta.object_name.lower()
|
to_name = to._meta.object_name.lower()
|
||||||
except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT
|
except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT
|
||||||
assert isinstance(to, basestring) , """ForeignKey(%r) is invalid. First parameter to ForeignKey must be either
|
assert isinstance(to, basestring), "ForeignKey(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT)
|
||||||
a model, a model name, or the string %r""" % (to, RECURSIVE_RELATIONSHIP_CONSTANT)
|
|
||||||
kwargs['verbose_name'] = kwargs.get('verbose_name', '')
|
kwargs['verbose_name'] = kwargs.get('verbose_name', '')
|
||||||
else:
|
else:
|
||||||
to_field = to_field or to._meta.pk.name
|
to_field = to_field or to._meta.pk.name
|
||||||
|
@ -101,7 +100,7 @@ class ForeignKey(SharedMethods, Field):
|
||||||
Field.__init__(self, **kwargs)
|
Field.__init__(self, **kwargs)
|
||||||
|
|
||||||
if not self.db_index:
|
if not self.db_index:
|
||||||
self.db_index = True
|
self.db_index = True
|
||||||
|
|
||||||
def prepare_field_objs_and_params(self, manipulator, name_prefix):
|
def prepare_field_objs_and_params(self, manipulator, name_prefix):
|
||||||
params = {'validator_list': self.validator_list[:]}
|
params = {'validator_list': self.validator_list[:]}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class AutomaticManipulator(Manipulator):
|
||||||
setattr(other_cls, name, ManipulatorDescriptor(name, cls))
|
setattr(other_cls, name, ManipulatorDescriptor(name, cls))
|
||||||
contribute_to_class = classmethod(contribute_to_class)
|
contribute_to_class = classmethod(contribute_to_class)
|
||||||
|
|
||||||
def __init__(self, original_object= None, follow=None):
|
def __init__(self, original_object=None, follow=None):
|
||||||
self.follow = self.model._meta.get_follow(follow)
|
self.follow = self.model._meta.get_follow(follow)
|
||||||
self.fields = []
|
self.fields = []
|
||||||
self.original_object = original_object
|
self.original_object = original_object
|
||||||
|
|
Loading…
Reference in New Issue