Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit b9e40b14bc6966504da43b8637a83ad1491a877b 1 parent b8d8aca
@adrianholovaty adrianholovaty authored
View
2  django/contrib/admin/views/main.py
@@ -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
4 django/core/meta/__init__.py
@@ -410,7 +410,7 @@ def __init__(self, module_name='', verbose_name='', verbose_name_plural='', db_t
# 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
6 django/core/meta/fields.py
@@ -133,7 +133,7 @@ def __init__(self, verbose_name=None, name=None, primary_key=False,
# 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 @@ def __init__(self, to, to_field=None, **kwargs):
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 @@ def __init__(self, to, singular=None, num_in_admin=0, related_name=None,
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
2  django/models/__init__.py
@@ -26,7 +26,7 @@
# 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)
Please sign in to comment.
Something went wrong with that request. Please try again.