From d5516f9828fd7ab5e59359ad6ade5fa5bcbbb949 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Fri, 25 Nov 2016 08:45:40 +0100 Subject: [PATCH] Try importing `rest_framework` module (#568) * Try importing `rest_framework` module Fixes #567 * Correct Typo Thanks @kevin-brown! --- django_filters/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django_filters/__init__.py b/django_filters/__init__.py index 6f24007..b9f9281 100644 --- a/django_filters/__init__.py +++ b/django_filters/__init__.py @@ -4,6 +4,13 @@ from .constants import STRICTNESS from .filterset import FilterSet from .filters import * +# We make the `rest_framework` module available without an additional import. +# If DRF is not installed we simply set None. +try: + from . import rest_framework +except ImportError: + rest_framework = None + __version__ = '1.0.0'