title: Get primary key of a deserialized object in Django
body: <p>I have a list of objects stored in session (to pass the list from one view to another) [okay, there has to be a better way of doing this but this is a question for another time!]</p>
  
  <p>I access the list from the session by doing:</p>
  
  <pre><code>object_list = request.session.get('object_list', None)
  </code></pre>
  
  <p>But this object_list is actually a serialized django object.</p>
  
  <p>What i need is to now get all the pk of this object_list (to then rebuild a clean queryset...)</p>
  
  <p>I tried this (deserializing then getting pk)</p>
  
  <pre><code>object_list_id=[]
  for obj in serializers.deserialize("json", object_list):
              object_list_id.append(obj.pk)
  </code></pre>
  
  <p>but it doesn't seem to work.. any ideas ?</p>
  
  <pre><code>'DeserializedObject' object has no attribute 'pk'
  </code></pre>
  
  <p>PS: if i debug the obj from the loop, this is the object type:</p>
  
  <pre><code>{&lt;DeserializedObject: riskass.Rating(pk=7)&gt;}
  </code></pre>