From 50ed810c1ffcda2432cf1417d739a98c78f572b1 Mon Sep 17 00:00:00 2001
From: Jannis Leidel <jannis@leidel.info>
Date: Fri, 29 Jul 2011 09:40:09 +0000
Subject: [PATCH] Fixed #16472 -- Removed stale code in the query code. Thanks,
 fva@chtd.org.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16562 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/db/models/query.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/django/db/models/query.py b/django/db/models/query.py
index af62061e11..ff5289c89c 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -226,7 +226,6 @@ class QuerySet(object):
         only_load = self.query.get_loaded_field_names()
         if not fill_cache:
             fields = self.model._meta.fields
-            pk_idx = self.model._meta.pk_index()
 
         load_fields = []
         # If only/defer clauses have been specified,
@@ -235,9 +234,6 @@ class QuerySet(object):
             for field, model in self.model._meta.get_fields_with_model():
                 if model is None:
                     model = self.model
-                if field == self.model._meta.pk:
-                    # Record the index of the primary key when it is found
-                    pk_idx = len(load_fields)
                 try:
                     if field.name in only_load[model]:
                         # Add a field that has been explicitly included
@@ -276,7 +272,6 @@ class QuerySet(object):
             else:
                 if skip:
                     row_data = row[index_start:aggregate_start]
-                    pk_val = row_data[pk_idx]
                     obj = model_cls(**dict(zip(init_list, row_data)))
                 else:
                     # Omit aggregates in object creation.