title: Get object by field other than primary key
body: <p>Hi I'm new to both Django and the Django-Rest-Framework. I've gone through the tutorials. What I'm trying to do (as a learning exercise) is return an object based off a field other than the primary key. </p>
  
  <ul>
  <li><code>myserver:8000/videos</code> returns a list of all videos.</li>
  <li><code>myserver:8000/videos/1</code> returns the video with primary key of 1</li>
  </ul>
  
  <p>What I would like to do is:</p>
  
  <ul>
  <li><code>myserver:8000/videos/:videoname</code> returns the video where <code>videoname = videoname</code></li>
  </ul>
  
  <p>I have the following Videos model:</p>
  
  <pre><code>class Videos (models.Model):
      videoID = models.IntegerField(blank=True, null=True)
      videoName = models.CharField(max_length=20)
      class Meta:
          app_label="quickstart"
  </code></pre>
  
  <p>My router is configured as:</p>
  
  <pre><code>video_detail = views.VideoDetailView.as_view({
      'get':'list'
  })
  
  urlpatterns = patterns('',
      url(r'^', include(router.urls)),
      url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
      url(r'^videos/(?P&lt;videoName&gt;[^/]+)/$', video_detail)
  )
  </code></pre>
  
  <p>And my view is defined as:</p>
  
  <pre><code>class VideoDetailView(viewsets.ModelViewSet):
      serializer_class = VideosSerializer
      def get_queryset(self):
          videoName = self.kwargs.get(videoName, None)
          queryset = super (VideoDetailView,self).get_queryset()
          if videoName:
              queryset = queryset.filter(videoName=videoName)
          return queryset
  </code></pre>
  
  <p>The api runs but when I hit: <code>myserver:8000/videos/SecondVideo/</code> (where "SecondVideo" is the name of the video) I get a 404 error.</p>
  
  <p>Any help?</p>