Guest User

Untitled

a guest
Jun 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. for modelclass, idlist in idlist_per_model.items():
  2. qs = modelclass.base_objects.filter(id__in=idlist)
  3. qs.dup_select_related(self) # copy select related configuration to new qs
  4.  
  5. for o in qs:
  6. + if type(o.pk) != type(o.id):
  7. + o.pk=o.id
  8. +
  9. if self.query.aggregates:
  10. for anno_field_name in self.query.aggregates.keys():
  11. attr = getattr(base_result_objects_by_id[o.pk], anno_field_name)
  12. setattr(o, anno_field_name, attr)
Add Comment
Please, Sign In to add comment