Renamed OneToOne to OneToOneRel to be consistent with ManyToManyRel

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-04-10 03:35:56 +00:00
parent b8d8aca5fd
commit b9e40b14bc
4 changed files with 7 additions and 7 deletions

View File

@ -560,7 +560,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
continue
opts_seen.append(related.opts)
rel_opts_name = related.get_method_name_part()
if isinstance(related.field.rel, meta.OneToOne):
if isinstance(related.field.rel, meta.OneToOneRel):
try:
sub_obj = getattr(obj, 'get_%s' % rel_opts_name)()
except ObjectDoesNotExist:

View File

@ -410,7 +410,7 @@ class Options:
# Calculate one_to_one_field.
self.one_to_one_field = None
for f in self.fields:
if isinstance(f.rel, OneToOne):
if isinstance(f.rel, OneToOneRel):
self.one_to_one_field = f
break
# Cache the primary-key field.
@ -1038,7 +1038,7 @@ def method_delete(opts, self):
cursor = db.db.cursor()
for related in opts.get_all_related_objects():
rel_opts_name = related.get_method_name_part()
if isinstance(related.field.rel, OneToOne):
if isinstance(related.field.rel, OneToOneRel):
try:
sub_obj = getattr(self, 'get_%s' % rel_opts_name)()
except ObjectDoesNotExist:

View File

@ -133,7 +133,7 @@ class Field(object):
# Set db_index to True if the field has a relationship and doesn't explicitly set db_index.
if db_index is None:
if isinstance(rel, OneToOne) or isinstance(rel, ManyToOneRel):
if isinstance(rel, OneToOneRel) or isinstance(rel, ManyToOneRel):
self.db_index = True
else:
self.db_index = False
@ -811,7 +811,7 @@ class OneToOneField(IntegerField):
warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.")
kwargs['edit_inline'] = kwargs.pop('edit_inline_type')
kwargs['rel'] = OneToOne(to, to_field,
kwargs['rel'] = OneToOneRel(to, to_field,
num_in_admin=kwargs.pop('num_in_admin', 0),
edit_inline=kwargs.pop('edit_inline', False),
related_name=kwargs.pop('related_name', None),
@ -855,7 +855,7 @@ class ManyToManyRel:
self.raw_id_admin = raw_id_admin
assert not (self.raw_id_admin and self.filter_interface), "ManyToManyRels may not use both raw_id_admin and filter_interface"
class OneToOne(ManyToOneRel):
class OneToOneRel(ManyToOneRel):
def __init__(self, to, field_name, num_in_admin=0, edit_inline=False,
related_name=None, limit_choices_to=None, lookup_overrides=None,
raw_id_admin=False):

View File

@ -26,7 +26,7 @@ for mod in modules:
# generated.
rel_mod = related.opts.get_model_module()
rel_obj_name = related.get_method_name_part()
if isinstance(related.field.rel, meta.OneToOne):
if isinstance(related.field.rel, meta.OneToOneRel):
# Add "get_thingie" methods for one-to-one related objects.
# EXAMPLE: Place.get_restaurants_restaurant()
func = curry(meta.method_get_related, 'get_object', rel_mod, related.field)