mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Added tests demonstrating that filtering lookup expression that involve model with inheritance schemes aren't incorrectly blacklisted by the r15031 security fix. Refs. #15032.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15178 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -33,7 +33,7 @@ from models import Article, BarAccount, CustomArticle, EmptyModel, \
|
||||
FooAccount, Gallery, ModelWithStringPrimaryKey, \
|
||||
Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, \
|
||||
Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, \
|
||||
Category, Post, Plot, FunkyTag, Chapter, Book, Promo
|
||||
Category, Post, Plot, FunkyTag, Chapter, Book, Promo, WorkHour, Employee
|
||||
|
||||
|
||||
class AdminViewBasicTest(TestCase):
|
||||
@@ -382,6 +382,16 @@ class AdminViewBasicTest(TestCase):
|
||||
except SuspiciousOperation:
|
||||
self.fail("Filters should be allowed if they involve a local field without the need to whitelist them in list_filter or date_hierarchy.")
|
||||
|
||||
e1 = Employee.objects.create(name='Anonymous', gender=1, age=22, alive=True, code='123')
|
||||
e2 = Employee.objects.create(name='Visitor', gender=2, age=19, alive=True, code='124')
|
||||
WorkHour.objects.create(datum=datetime.datetime.now(), employee=e1)
|
||||
WorkHour.objects.create(datum=datetime.datetime.now(), employee=e2)
|
||||
response = self.client.get("/test_admin/admin/admin_views/workhour/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'employee__person_ptr__exact')
|
||||
response = self.client.get("/test_admin/admin/admin_views/workhour/?employee__person_ptr__exact=%d" % e1.pk)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
class SaveAsTests(TestCase):
|
||||
fixtures = ['admin-views-users.xml','admin-views-person.xml']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user