title: Django URL invalid literal for int() with base 10
body: <p>I have a Location model setup in Django and I originally set it up so that the URL was /location/3/ using the primary key. but the client want to change it to use a slug of the location name. I created a slug field in the model. And changed the URL pattern in urls.py.</p>
  
  <pre><code>urlpatterns = [
      url(r'^(?P&lt;pk&gt;[\w-]+)/$', views.LocationsSingleView.as_view(), name='detail'),
  ]
  </code></pre>
  
  <p>I can link to them fine. But when it tries to actually load that page I get an error:</p>
  
  <blockquote>
    <p>invalid literal for int() with base 10: 'eau-claire'</p>
  </blockquote>
  
  <p>Where eau-claire is the slug for that Location.</p>
  
  <p><a href="https://docs.djangoproject.com/en/1.11/topics/http/urls/" rel="nofollow noreferrer">Documentation</a> doesn't say anything about this.</p>
  
  <p>A lot of people with this issue have issues with their view. But my view is super simple. So I don't know what's wrong. Here is my view:</p>
  
  <pre><code>class LocationsSingleView(DetailView):
      model = models.Location
  </code></pre>