We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c49c65b commit d0b0683Copy full SHA for d0b0683
tests/test_filtering.py
@@ -387,6 +387,23 @@ class Meta:
387
# should pass
388
NoteFilter(GET, queryset=Note.objects.all(), request=object()).qs
389
390
+ def test_validation(self):
391
+ class F(PostFilter):
392
+ pk = filters.NumberFilter(name='id')
393
+
394
+ GET = {
395
+ 'note__author': 'foo',
396
+ 'pk': 'bar',
397
+ }
398
399
+ f = F(GET, queryset=Post.objects.all())
400
+ self.assertQuerysetEqual(f.qs, Post.objects.none())
401
+ self.assertFalse(f.form.is_valid())
402
403
+ self.assertEqual(len(f.form.errors.keys()), 2)
404
+ self.assertIn('note__author', f.form.errors)
405
+ self.assertIn('pk', f.form.errors)
406
407
408
class MiscTests(TestCase):
409
def test_multiwidget_incompatibility(self):
0 commit comments