Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix form attr references in tests #789

Merged
merged 1 commit into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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