  
  
  factory = APIRequestFactory()
  
  mock_view = lambda request: None
  
  included_patterns = [
      url(r'^namespaced/$', mock_view, name='another'),
 
</s> remove     default_version = None
 </s> add     invalid_version_message = _('Invalid version in URL path.') </s> remove 
class QueryParameterVersioning(BaseVersioning):
    """
    GET /something/?version=0.1 HTTP/1.1
    Host: example.com
    Accept: application/json
    """
    default_version = None
    version_param = 'version'

    def determine_version(self, request, *args, **kwargs):
        return request.query_params.get(self.version_param)

    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):
        url = super(QueryParameterVersioning, self).reverse(
            viewname, args, kwargs, request, format, **extra
        )
        if request.version is not None:
            return replace_query_param(url, self.version_param, request.version)
        return url


class HostNameVersioning(BaseVersioning):
    """
    GET /something/ HTTP/1.1
    Host: v1.example.com
    Accept: application/json
    """
    default_version = None
    hostname_regex = re.compile(r'^([a-zA-Z0-9]+)\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$')

    def determine_version(self, request, *args, **kwargs):
        hostname, seperator, port = request.get_host().partition(':')
        match = self.hostname_regex.match(hostname)
        if not match:
            return self.default_version
        return match.group(1)

    # We don't need to implement `reverse`, as the hostname will already be
    # preserved as part of the REST framework `reverse` implementation.
 </s> add     def is_allowed_version(self, version):
        if not self.allowed_versions:
            return True
        return (version == self.default_version) or (version in self.allowed_versions)
class RequestInvalidVersionView(APIView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2')
        return (scheme.determine_version(request, *args, **kwargs), scheme)

    def get(self, request, *args, **kwargs):
        return Response({'version': request.version})


  
  
class RequestInvalidVersionView(APIView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2')
        return (scheme.determine_version(request, *args, **kwargs), scheme)

    def get(self, request, *args, **kwargs):
        return Response({'version': request.version})


  factory = APIRequestFactory()
  
  mock_view = lambda request: None
  
  included_patterns = [
      url(r'^namespaced/$', mock_view, name='another'),
keep add keep keep keep keep keep keep
 More docs, plus 'ALLOWED_VERSIONS' setting. 
tests/test_versioning.py