Ticket #16472: clean.diff

File clean.diff, 1.3 KB (added by fva@…, 13 years ago)

trunk diff

  • django/db/models/query.py

     
    226226        only_load = self.query.get_loaded_field_names()
    227227        if not fill_cache:
    228228            fields = self.model._meta.fields
    229             pk_idx = self.model._meta.pk_index()
    230229
    231230        load_fields = []
    232231        # If only/defer clauses have been specified,
     
    235234            for field, model in self.model._meta.get_fields_with_model():
    236235                if model is None:
    237236                    model = self.model
    238                 if field == self.model._meta.pk:
    239                     # Record the index of the primary key when it is found
    240                     pk_idx = len(load_fields)
    241237                try:
    242238                    if field.name in only_load[model]:
    243239                        # Add a field that has been explicitly included
     
    276272            else:
    277273                if skip:
    278274                    row_data = row[index_start:aggregate_start]
    279                     pk_val = row_data[pk_idx]
    280275                    obj = model_cls(**dict(zip(init_list, row_data)))
    281276                else:
    282277                    # Omit aggregates in object creation.
Back to Top