summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.co.uk>2016-11-17 08:26:40 (GMT)
committerGitHub <noreply@github.com>2016-11-17 08:26:40 (GMT)
commite7fa6989a3fbd6620a72860effbcbadec4d9e2f7 (patch)
tree3c950e1214a844690de88775d0525c94b411cfc2
parenta95c528a9ac4459a7e0eb747a7b598d6822c4056 (diff)
parenta0245120f04826e6f4c0deb6f26c66658daa9376 (diff)
downloaddjango-filter-e7fa6989a3fbd6620a72860effbcbadec4d9e2f7.zip
django-filter-e7fa6989a3fbd6620a72860effbcbadec4d9e2f7.tar.gz
django-filter-e7fa6989a3fbd6620a72860effbcbadec4d9e2f7.tar.bz2
Merge pull request #563 from Logimeter/schema-description
Include filter fields' help text as coreapi descriptions
-rw-r--r--django_filters/rest_framework/backends.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django_filters/rest_framework/backends.py b/django_filters/rest_framework/backends.py
index 73aa0eb..34ba2ac 100644
--- a/django_filters/rest_framework/backends.py
+++ b/django_filters/rest_framework/backends.py
@@ -2,6 +2,7 @@
from __future__ import absolute_import
from django.template import Template, TemplateDoesNotExist, loader
+from django.utils import six
from rest_framework.compat import template_render
from rest_framework.filters import BaseFilterBackend
@@ -98,6 +99,7 @@ class DjangoFilterBackend(BaseFilterBackend):
filter_class = self.get_filter_class(view, view.get_queryset())
return [] if not filter_class else [
- compat.coreapi.Field(name=field_name, required=False, location='query')
- for field_name in filter_class().filters.keys()
+ compat.coreapi.Field(
+ name=field_name, required=False, location='query', description=six.text_type(field.field.help_text))
+ for field_name, field in filter_class().filters.items()
]