Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Fixed #1598 -- Removed some references to get_object()

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2644 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 74be99501473433d6e43024d2d8d3fc0bbeb9fc3 1 parent 8d9ebc6
Adrian Holovaty authored
13  django/db/models/base.py
@@ -277,13 +277,12 @@ def _get_next_or_previous_in_order(self, is_next):
277 277
         if not hasattr(self, cachename):
278 278
             op = is_next and '>' or '<'
279 279
             order_field = self.order_with_respect_to
280  
-            obj = self._default_manager.get_object(order_by=('_order',),
281  
-                where=['%s %s (SELECT %s FROM %s WHERE %s=%%s)' % \
282  
-                    (backend.quote_name('_order'), op, backend.quote_name('_order'),
283  
-                    backend.quote_name(opts.db_table), backend.quote_name(opts.pk.column)),
284  
-                    '%s=%%s' % backend.quote_name(order_field.column)],
285  
-                limit=1,
286  
-                params=[self._get_pk_val(), getattr(self, order_field.attname)])
  280
+            where = ['%s %s (SELECT %s FROM %s WHERE %s=%%s)' % \
  281
+                (backend.quote_name('_order'), op, backend.quote_name('_order'),
  282
+                backend.quote_name(opts.db_table), backend.quote_name(opts.pk.column)),
  283
+                '%s=%%s' % backend.quote_name(order_field.column)]
  284
+            params = [self._get_pk_val(), getattr(self, order_field.attname)]
  285
+            obj = self._default_manager.order_by('_order').extra(where=where, params=params)[:1].get()
287 286
             setattr(self, cachename, obj)
288 287
         return getattr(self, cachename)
289 288
 
4  django/db/models/fields/related.py
@@ -38,7 +38,7 @@ def manipulator_valid_rel_key(f, self, field_data, all_data):
@@ -392,7 +392,7 @@ def __get__(self, instance, instance_type=None):
2  django/db/models/manipulators.py
@@ -263,7 +263,7 @@ def __init__(self, obj_key, follow=None):
263 263
                 # Let the ObjectDoesNotExist exception propogate up.
264 264
                 lookup_kwargs = self.opts.one_to_one_field.rel.limit_choices_to
265 265
                 lookup_kwargs['%s__exact' % self.opts.one_to_one_field.rel.field_name] = obj_key
266  
-                _ = self.opts.one_to_one_field.rel.to.get_model_module().get_object(**lookup_kwargs)
  266
+                self.opts.one_to_one_field.rel.to.get_model_module().get(**lookup_kwargs)
267 267
                 params = dict([(f.attname, f.get_default()) for f in self.opts.fields])
268 268
                 params[self.opts.pk.attname] = obj_key
269 269
                 self.original_object = self.opts.get_model_module().Klass(**params)

0 notes on commit 74be995

Please sign in to comment.
Something went wrong with that request. Please try again.