Skip to content

Commit

Permalink
Fix form attr references in tests (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan P Kilby authored and Carlton Gibson committed Oct 17, 2017
1 parent 91205ea commit 22052d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions django_filters/rest_framework/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def get_schema_fields(self, view):
return [] if not filter_class else [
compat.coreapi.Field(
name=field_name,
required=field.required,
required=field.extra['required'],
location='query',
schema=self.get_coreschema_field(field)
)
for field_name, field in filter_class.base_filters.items()
) for field_name, field in filter_class.base_filters.items()
]
2 changes: 1 addition & 1 deletion tests/rest_framework/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def test_widget(self):
# from `rest_framework.filters`.
f = filters.BooleanFilter()

self.assertEqual(f.widget, BooleanWidget)
self.assertEqual(f.extra['widget'], BooleanWidget)
2 changes: 1 addition & 1 deletion tests/rest_framework/test_filterset.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_booleanfilter_widget(self):
field = User._meta.get_field('is_active')
result = FilterSet.filter_for_field(field, 'is_active')
self.assertIsInstance(result, filters.BooleanFilter)
self.assertEqual(result.widget, BooleanWidget)
self.assertEqual(result.extra['widget'], BooleanWidget)


@skipIf(is_crispy(), 'django_crispy_forms must be installed')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def __init__(self, *args, **kwargs):
'queryset': Book.objects.filter(id__in=[1, 2])
})

self.filters['favorite_books'].required = True
self.filters['favorite_books'].extra['required'] = True

qs = User.objects.all().order_by('username')

Expand Down

0 comments on commit 22052d7

Please sign in to comment.