          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()
  
  
 
</s> remove class RequestInvalidVersionView(APIView):
 </s> add class AllowedVersionsView(RequestVersionView): </s> remove         view = RequestInvalidVersionView.as_view(versioning_class=scheme)
 </s> add         view = AllowedVersionsView.as_view(versioning_class=scheme) </s> remove         view = RequestInvalidVersionView.as_view(versioning_class=scheme)
 </s> add         view = AllowedVersionsView.as_view(versioning_class=scheme) </s> remove         view = RequestInvalidVersionView.as_view(versioning_class=scheme)
 </s> add         view = AllowedVersionsView.as_view(versioning_class=scheme) </s> remove         view = RequestInvalidVersionView.as_view(versioning_class=scheme)
 </s> add         view = AllowedVersionsView.as_view(versioning_class=scheme)
class AllowedAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2')
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)


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


class AllowedWithNoneAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2', None)
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)
          scheme = self.versioning_class()
          scheme.allowed_versions = ('v1', 'v2')
          return (scheme.determine_version(request, *args, **kwargs), scheme)
  
class AllowedAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2')
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)


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


class AllowedWithNoneAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2', None)
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)
class AllowedAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2')
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)


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


class AllowedWithNoneAndDefaultVersionsView(RequestVersionView):
    def determine_version(self, request, *args, **kwargs):
        scheme = self.versioning_class()
        scheme.allowed_versions = ('v1', 'v2', None)
        scheme.default_version = 'v2'
        return (scheme.determine_version(request, *args, **kwargs), scheme)
  
  
  factory = APIRequestFactory()
  
  
keep keep keep keep replace replace keep keep keep keep keep
 Fix handling of ALLOWED_VERSIONS and no DEFAULT_VERSION (#4370)

When only `ALLOWED_VERSIONS` but no `DEFAULT_VERSION` is specified, a
version should be enforced. 
tests/test_versioning.py