mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.10.x] Fixed #26983 -- Fixed isnull filtering on ForeignKey with to_field
Thanks weidwonder for the report.
Backport of 272eccf7ff from master.
			
			
This commit is contained in:
		| @@ -2483,6 +2483,19 @@ class ToFieldTests(TestCase): | ||||
|             [node1] | ||||
|         ) | ||||
|  | ||||
|     def test_isnull_query(self): | ||||
|         apple = Food.objects.create(name="apple") | ||||
|         Eaten.objects.create(food=apple, meal="lunch") | ||||
|         Eaten.objects.create(meal="lunch") | ||||
|         self.assertQuerysetEqual( | ||||
|             Eaten.objects.filter(food__isnull=False), | ||||
|             ['<Eaten: apple at lunch>'] | ||||
|         ) | ||||
|         self.assertQuerysetEqual( | ||||
|             Eaten.objects.filter(food__isnull=True), | ||||
|             ['<Eaten: None at lunch>'] | ||||
|         ) | ||||
|  | ||||
|  | ||||
| class ConditionalTests(BaseQuerysetTest): | ||||
|     """Tests whose execution depend on different environment conditions like | ||||
|   | ||||
		Reference in New Issue
	
	Block a user