Ticket #26983: testcase-26983.diff

File testcase-26983.diff, 1.0 KB (added by Baptiste Mispelon, 8 years ago)

Reproduction testcase (simplified)

  • new file tests/aaaaaa/models.py

    diff --git a/tests/aaaaaa/__init__.py b/tests/aaaaaa/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/aaaaaa/models.py b/tests/aaaaaa/models.py
    new file mode 100644
    index 0000000..e96855d
    - +  
     1from django.db import models
     2
     3class ModelManager(models.Manager):
     4    def get_queryset(self):
     5        return super(ModelManager, self).get_queryset().filter(parent__isnull=False)
     6
     7class Category(models.Model):
     8    parent = models.ForeignKey('Category', to_field='slug', blank=True, null=True, on_delete=models.SET_NULL)
     9    slug = models.SlugField()
     10
     11    vehicle_models = ModelManager()
  • new file tests/aaaaaa/tests.py

    diff --git a/tests/aaaaaa/tests.py b/tests/aaaaaa/tests.py
    new file mode 100644
    index 0000000..d51edff
    - +  
     1from django.test import TestCase
     2
     3from .models import Category
     4
     5
     6class ReproTestCase(TestCase):
     7    def test_repro(self):
     8        qs = Category.vehicle_models.all()
     9        self.assertIn('IS NOT NULL', str(qs.query))
Back to Top