magic-removal: Got rid of some uses of '_', the special underscore variable, where it's not needed. Trying to solve a weird bug.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2fb5430f3a
commit
50b5f9da63
|
@ -2,4 +2,4 @@ class FieldDoesNotExist(Exception):
|
|||
pass
|
||||
|
||||
class BadKeywordArguments(Exception):
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -142,7 +142,7 @@ class AutomaticManipulator(Manipulator):
|
|||
obj_list.sort(lambda x, y: cmp(int(x[0]), int(y[0])))
|
||||
|
||||
# For each related item...
|
||||
for _, rel_new_data in obj_list:
|
||||
for null, rel_new_data in obj_list:
|
||||
|
||||
params = {}
|
||||
|
||||
|
@ -265,7 +265,7 @@ class ModelChangeManipulator(AutomaticManipulator):
|
|||
# Let the ObjectDoesNotExist exception propogate up.
|
||||
lookup_kwargs = opts.one_to_one_field.rel.limit_choices_to
|
||||
lookup_kwargs['%s__exact' % opts.one_to_one_field.rel.field_name] = obj_key
|
||||
_ = opts.one_to_one_field.rel.to._meta.get_model_module().get_object(**lookup_kwargs)
|
||||
null = opts.one_to_one_field.rel.to._meta.get_model_module().get_object(**lookup_kwargs)
|
||||
params = dict([(f.attname, f.get_default()) for f in opts.fields])
|
||||
params[opts.pk.attname] = obj_key
|
||||
original_object = opts.get_model_module().Klass(**params)
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.db import backend, connection
|
|||
from django.db.models.exceptions import *
|
||||
|
||||
LOOKUP_SEPARATOR = '__'
|
||||
|
||||
####################
|
||||
# HELPER FUNCTIONS #
|
||||
####################
|
||||
|
@ -119,7 +120,7 @@ class Q:
|
|||
def get_sql(self, opts, table_count):
|
||||
return parse_lookup(self.kwargs.items(), opts, table_count)
|
||||
|
||||
|
||||
|
||||
def get_where_clause(lookup_type, table_prefix, field_name, value):
|
||||
if table_prefix.endswith('.'):
|
||||
table_prefix = backend.quote_name(table_prefix[:-1])+'.'
|
||||
|
@ -300,4 +301,4 @@ def parse_lookup(kwarg_items, opts, table_count=0):
|
|||
throw_bad_kwarg_error(kwarg)
|
||||
except StopIteration:
|
||||
continue
|
||||
return tables, join_where, where, params, table_count
|
||||
return tables, join_where, where, params, table_count
|
||||
|
|
|
@ -56,13 +56,13 @@ class RelatedObject(object):
|
|||
|
||||
change = count - len(list)
|
||||
if change > 0:
|
||||
return list + [None for _ in range(change)]
|
||||
return list + [None for i in range(change)]
|
||||
if change < 0:
|
||||
return list[:change]
|
||||
else: # Just right
|
||||
return list
|
||||
else:
|
||||
return [None for _ in range(self.field.rel.num_in_admin)]
|
||||
return [None for i in range(self.field.rel.num_in_admin)]
|
||||
|
||||
|
||||
def editable_fields(self):
|
||||
|
@ -91,11 +91,11 @@ class RelatedObject(object):
|
|||
|
||||
def get_manipulator_fields(self, opts, manipulator, change, follow):
|
||||
# TODO: Remove core fields stuff.
|
||||
|
||||
|
||||
if manipulator.original_object:
|
||||
meth_name = 'get_%s_count' % self.get_method_name_part()
|
||||
count = getattr(manipulator.original_object, meth_name)()
|
||||
|
||||
|
||||
count += self.field.rel.num_extra_on_change
|
||||
if self.field.rel.min_num_in_admin:
|
||||
count = max(count, self.field.rel.min_num_in_admin)
|
||||
|
|
Loading…
Reference in New Issue