﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31762	Dabase creation backend should use base_manager to serialize database	Eugene K	Hasan Ramezani	"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"	Bug	closed	Testing framework	3.0	Normal	fixed			Ready for checkin	1	0	0	0	0	0
