title: Accessing Primary Key from URL in Django View Class
body: <p>I have a URL pattern mapped to a custom view class in my Django App, like so:</p>
  
  <pre><code>url( r'^run/(?P&lt;pk&gt;\d+)/$', views.PerfRunView.as_view( ))
  </code></pre>
  
  <p>The problem is, I cannot figure out how I can access 'pk' from the URL pattern string in my view class so that I can retrieve a specific model object based on its database id. I have googled, looked through the Django documentation, searched Stack Overflow, and I can't find a satisfactory answer at all.</p>
  
  <p>Can anybody tell me?</p>