title: Django template object property lookup with a dynamic variable name
body: <p>I have a table with user, rank, squat, deadlift, benchpress, Clean and Jerk and Snatch.    </p>
  
  <p>The ranking system will rank any number of combinations from just total amount Squated, to total amount benchpressed and deadlifted to the total amount lifted across all five disciplines. As you can see there is a huge number of available combinations that a user can check their rankings by. While i have as yet to painstakingly add all these ranking combinations to my database i have done the main 5 ie SQ_rank.</p>
  
  <p>In my views file i have done the following, where request.GET gets either 'SQ', 'DL', 'BP', 'Snatch' or 'CJ':</p>
  
  <pre><code>def rankings()
      a = ''
      for i in request.GET:
          a += i    
      b = a + '_rank'    
      query_results = UserProfile.objects.all().order_by(a)
      rank = b
      return render_to_response('registration/rankings.html',{'query_results': query_results, 'rank': rank,}, context_instance=RequestContext(request, processors=[custom_proc])) 
  </code></pre>
  
  <p>Now i want the rank as a variable inside of my template. it will return something _rank such as SQ_rank or DL_rank, which is in my database. </p>
  
  <pre><code>{% for item in query_results %}
      &lt;tr&gt;
      &lt;td&gt;{{ item.user }}&lt;/td&gt;
      &lt;td&gt;{{ items.??? }}&lt;/td&gt;
      &lt;td&gt;{{ item.SQ }}&lt;/td&gt;
      &lt;td&gt;{{ item.DL }}&lt;/td&gt;
      &lt;td&gt;{{ item.BP }}&lt;/td&gt;
      &lt;td&gt;{{ item.CJ }}&lt;/td&gt;
      &lt;td&gt;{{ item.Snatch }}&lt;/td&gt;
      &lt;/tr&gt;
  {% endfor %}
  </code></pre>
  
  <p>How do i do this without having a heap load of {% ifequal %}} tags accounting for all the varaible combinations that will be available when i get around to adding them to my database? Does all this make sense </p>