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:
Adrian Holovaty 2005-12-19 03:51:43 +00:00
parent 2fb5430f3a
commit 50b5f9da63
4 changed files with 10 additions and 9 deletions

View File

@ -142,7 +142,7 @@ class AutomaticManipulator(Manipulator):
obj_list.sort(lambda x, y: cmp(int(x[0]), int(y[0]))) obj_list.sort(lambda x, y: cmp(int(x[0]), int(y[0])))
# For each related item... # For each related item...
for _, rel_new_data in obj_list: for null, rel_new_data in obj_list:
params = {} params = {}
@ -265,7 +265,7 @@ class ModelChangeManipulator(AutomaticManipulator):
# Let the ObjectDoesNotExist exception propogate up. # Let the ObjectDoesNotExist exception propogate up.
lookup_kwargs = opts.one_to_one_field.rel.limit_choices_to 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 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 = dict([(f.attname, f.get_default()) for f in opts.fields])
params[opts.pk.attname] = obj_key params[opts.pk.attname] = obj_key
original_object = opts.get_model_module().Klass(**params) original_object = opts.get_model_module().Klass(**params)

View File

@ -2,6 +2,7 @@ from django.db import backend, connection
from django.db.models.exceptions import * from django.db.models.exceptions import *
LOOKUP_SEPARATOR = '__' LOOKUP_SEPARATOR = '__'
#################### ####################
# HELPER FUNCTIONS # # HELPER FUNCTIONS #
#################### ####################

View File

@ -56,13 +56,13 @@ class RelatedObject(object):
change = count - len(list) change = count - len(list)
if change > 0: if change > 0:
return list + [None for _ in range(change)] return list + [None for i in range(change)]
if change < 0: if change < 0:
return list[:change] return list[:change]
else: # Just right else: # Just right
return list return list
else: 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): def editable_fields(self):