title: TypeError at / can only concatenate str (not "builtin_function_or_method") to str
body: <p>Thank you for your time.</p>
  <p>I was working on django rest framework documentation, and only with Localhost &quot;http://127.0.0.1:8000/&quot; URL I get this error.</p>
  <p><em>TypeError at /
  can only concatenate str (not &quot;builtin_function_or_method&quot;) to str</em></p>
  <p>I have attached Views.py, snippets/url.py and snippets/serializers.py</p>
  <p><em><strong>views.py</strong></em></p>
  <pre><code>from snippets.permissions import IsOwnerOrReadOnly
  from snippets.models import Snippet
  from snippets.serializers import SnippetSerializer, UserSerializer
  from rest_framework import generics, permissions    
  from django.contrib.auth.models import User
  from rest_framework.decorators import api_view
  from rest_framework.response import Response
  from rest_framework import renderers
  from rest_framework.reverse import reverse
  
  
  @api_view(['GET']
  def api_root(request, fromat=None):
      return Response({
          'users': reverse('user-list', request=request, format=format),
          'snippets': reverse('snippet-list', request=request, format=format)
  })
  
  class SnippetHighlight(generics.GenericAPIView):
      queryset = Snippet.objects.all()
      renderer_classes = [renderers.StaticHTMLRenderer]
  
      def get(self, request, *args, **kwargs):
          snippet = self.get_object()
          return Response(snippet.highlighted
  
  class SnippetList(generics.ListCreateAPIView):
      queryset = Snippet.objects.all()
      serializer_class = SnippetSerializer
      permission_classes = [permissions.IsAuthenticatedOrReadOnly]
  
      def perform_create(self, serializer):
           serializer.save(owner=self.request.user)
  
  class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
      queryset = Snippet.objects.all()
      serializer_class = SnippetSerializer
      permission_classes = [permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly]
  
  class UserList(generics.ListAPIView):
      queryset = User.objects.all()
      serializer_class = UserSerializer
  
  class UserDetail(generics.RetrieveAPIView):
      queryset = User.objects.all()
      serializer_class = UserSerializer
  </code></pre>
  <p><strong>snippets/urls.py</strong></p>
  <pre><code>from django.urls import path
  from rest_framework.urlpatterns import format_suffix_patterns
  from snippets import views
  
  
  urlpatterns = format_suffix_patterns([
      path('', views.api_root),
  
      path('snippets/', views.SnippetList.as_view(), name='snippet-list'),
      path('snippets/&lt;int:pk&gt;/', views.SnippetDetail.as_view(), name='snippet-detail'),
      path('snippets/&lt;int:pk&gt;/highlight/', views.SnippetHighlight.as_view(), name='snippet- 
      highlight'),
  
      path('users/', views.UserList.as_view(), name='user-list'),
      path('users/&lt;int:pk&gt;/', views.UserDetail.as_view(), name='user-detail')
  ])
  </code></pre>
  <p><strong>serializer.py</strong></p>
  <pre><code>from rest_framework import serializer
  from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES
  from django.contrib.auth.models import User
  
  
  class SnippetSerializer(serializers.HyperlinkedModelSerializer):
      owner = serializers.ReadOnlyField(source='owner.username')
      highlight = serializers.HyperlinkedIdentityField(view_name='snippet-highlight', 
      format='html')
  
      class Meta:
          model = Snippet
          fields = ['url','id','highlight', 'owner' ,'title', 'code', 'linenos', 'language', 
          'style']
      
      
  class UserSerializer(serializers.ModelSerializer):
      snippets = serializers.HyperlinkedIdentityField(many=True, view_name='snippet-detail', 
      read_only=True)
  
      class Meta:
           model = User
           fields = ['url', 'id', 'username', 'snippets']     
      
  </code></pre>
  <p><a href="https://i.stack.imgur.com/XL20r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XL20r.png" alt="enter image description here" /></a></p>
  <p>irrespective of this everything's working perfectly, like <a href="http://127.0.0.1:8000/snippets/" rel="nofollow noreferrer">http://127.0.0.1:8000/snippets/</a>
  <a href="https://i.stack.imgur.com/1jgQQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1jgQQ.png" alt="enter image description here" /></a></p>