#31762: Dabase creation backend should use base_manager to serialize database -----------------------------------------+------------------------ Reporter: Eugene K | Owner: nobody Type: Uncategorized | Status: new Component: Uncategorized | Version: 3.0 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+------------------------ models.py {{{ class Service(Model): objects = CustomManagerThatFillterOutSomeRecords()
class CustomManagerThatFillterOutSomeRecords(Manager): def get_queryset(self): return super().get_queryset().exclude(pk=1) }}} tests.py {{{ class TestService(TransactionTestCase): serialized_rollback = True def test_something(self): pass }}} Assume we have a migration that creates few records of Service. {{{ from django.core.management import call_command from django.db import migrations def load_fixtures(*_, **__): call_command('loaddata', 'services.json') class Migration(migrations.Migration): dependencies = [] operations = [ migrations.RunPython( load_fixtures, migrations.RunPython.noop, ) ] }}} Then `TestService` will fail as `serialize_db_to_string` by default use `_default_manager` that is `CustomManagerThatFillterOutSomeRecords`. Here is proposed fix: https://github.com/django/django/pull/13150 -- Ticket URL: <https://code.djangoproject.com/ticket/31762> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/055.74334f06cf01508c4fea33e8abe6f27f%40djangoproject.com.