Ticket #24421: test_bug.py

File test_bug.py, 674 bytes (added by Daniel Boeve, 10 years ago)
Line 
1from django.db import models
2from django.test.testcases import TestCase
3
4
5class MyModel(models.Model):
6 group_id = models.PositiveIntegerField()
7 user_id = models.PositiveIntegerField()
8 other_id = models.PositiveIntegerField(null=True)
9 other = models.ForeignObject(
10 'OtherModel',
11 from_fields=('other_id', 'user_id', 'group_id'),
12 to_fields=('id', 'user_id', 'group_id'),
13 null=True
14 )
15
16
17class OtherModel(models.Model):
18 group_id = models.PositiveIntegerField()
19 user_id = models.PositiveIntegerField()
20
21
22class BugTestCase(TestCase):
23
24 def test_bug(self):
25 OtherModel.objects.exclude(mymodel__id__in=[1,2,3])[0]
Back to Top