From b42b16d0e66394c78b19f16f102187e55211622e Mon Sep 17 00:00:00 2001 From: Markus Korn Date: Mon, 22 Jun 2015 16:13:42 +0200 Subject: [PATCH] compat: invert logic for checking the django version when implementing RequestFactory.generic() --- rest_framework/compat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 498eb8e5f..e7a73adda 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -210,7 +210,9 @@ except ImportError: # RequestFactory only provides `generic` from 1.5 onwards -if django.VERSION < (1, 5): +if django.VERSION >= (1, 5): + from django.test.client import RequestFactory +else: from django.test.client import RequestFactory as DjangoRequestFactory class RequestFactory(DjangoRequestFactory): @@ -231,8 +233,6 @@ if django.VERSION < (1, 5): }) r.update(extra) return self.request(**r) -else: - from django.test.client import RequestFactory # Markdown is optional