Browse files

Corrected how query terms are found, for Django 1.5 compatibility. Th…

…anks to maraujop for the original patch!
  • Loading branch information...
1 parent a5456df commit 5397dec04fe83092a56ba14a843731f2aa08184d @toastdriven toastdriven committed Aug 14, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 tastypie/resources.py
View
7 tastypie/resources.py
@@ -1733,7 +1733,12 @@ def build_filters(self, filters=None):
if hasattr(self._meta, 'queryset'):
# Get the possible query terms from the current QuerySet.
- query_terms = self._meta.queryset.query.query_terms.keys()
+ if hasattr(self._meta.queryset.query.query_terms, 'keys'):
+ # Django 1.4 & below compatibility.
+ query_terms = self._meta.queryset.query.query_terms.keys()
+ else:
+ # Django 1.5+.
+ query_terms = self._meta.queryset.query.query_terms
else:
query_terms = QUERY_TERMS.keys()

0 comments on commit 5397dec

Please sign in to comment.