title: accessing dict values from request.session in views
body: <p>I'm trying to obtain a session variable within a view but I'm not having much luck. 
  The error I'm receiving is:</p>
  
  <p><strong>list indices must be integers, not str</strong></p>
  
  <p>I have the following session variable/dict being set: </p>
  
  <pre><code>u'bookingContents' :    
      {
      u'bookingID': 40, 
      u'bookingOptionContents': {
          u'activityID': 1, 
          u'activityName': u'Echo Park legging races', 
          u'activityShortDescription': u'YOLO umami occupy, Echo Park leggings meh Kickstarter cardigan. ', 
          u'activityThumbnail': u'/media/activity/1/thumb_test.jpg', 
          u'optionCost': 20, 
          u'optionDayOfWeek': u'Tuesday', 
          u'optionEndTime': u'12:00', 
          u'optionStartDate': u'19/01/2015', 
          u'optionStartTime': u'06:00', 
          u'quantity': 9}, 
      u'bookingOptionID': 1}
  </code></pre>
  
  <p>I'm trying to access the bookingID and the bookingOptionsContents.quantity values by their label (preferably).</p>
  
  <p>My views code is as follows (for the first bookingID value):</p>
  
  <pre><code>if int(request.session.get('bookingContents.bookingID', False)) == somevalue:
  </code></pre>
  
  <p>i've also tried:</p>
  
  <pre><code>if int(request.session.get('[bookingContents']['bookingID'], False)) == somevalue:
  </code></pre>
  
  <p>but i can't seem to get at the values.</p>
  
  <p>Things work within a template, where I can successfully retrieve the values via:</p>
  
  <pre><code>{{request.session.bookingContents.bookingOptionContents.quantity}}
  {{request.session.bookingContents.bookingID}}
  </code></pre>
  
  <p><strong>How do I get the value for bookingID and quantity in a view?</strong></p>