title: Creating custom Django REST url using multiple fields
body: <p>I'm building an SMS API that talks to a Django database, which is a list of contact information for several hundred people. The fields are as follows: first name, last name, phone number and job title.</p>
  
  <p>I'm getting responses when I use this url on my local server:</p>
  
  <pre><code>http://localhost:8000/sources/id
  </code></pre>
  
  <p>What I'd like to do is make requests to the same database using this url:</p>
  
  <pre><code>http://localhost:8000/sources/first_name-last_name
  </code></pre>
  
  <p>I've investigated multiple questions about field lookups, but there hasn't been anything helpful. Here's what my serializers.py look like:</p>
  
  <pre><code>from rest_framework import serializers, viewsets
  from text_source.models import Source
  
  class SourceSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Source
          fields = ('id','first_name','last_name','title','organization','city','cell_phone','office_phone')
          lookup_field = 'first_name'
  
  class SourceViewSet(viewsets.ModelViewSet):
      queryset = Source.objects.all()
      serializer_class = SourceSerializer
      lookup_field = ('first_name')
  </code></pre>
  
  <p>I'm not sure if using /first_name-last_name as an end point for the url is best practice, but, in theory for what I'm doing, it will work. </p>
  
  <p>Ideally, I'd like for someone to type FIRSTNAME LASTNAME in the text and have the API return the correct information by connecting the full name to the ID in the database. Any tips to accomplishing that would be greatly appreciated. </p>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import include, url
  from django.contrib import admin
  from django.views.generic.base import TemplateView
  from django.contrib.auth.models import User
  
  from rest_framework import routers, serializers, viewsets
  from app import views
  from app.serializers import SourceSerializer, SourceViewSet
  
  router = routers.DefaultRouter()
  router.register(r'sources', SourceViewSet)
  
  urlpatterns = [
  
      url(r'^page/$', TemplateView.as_view(template_name='base.html')),
  
      url(r'^page/', include(router.urls)),
  
      url(r'^admin/', include(admin.site.urls)),
  
      url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
  
      url(r'^page/incoming/message$', views.incoming_message)
  ]
  </code></pre>