﻿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
15113	post_sync signal's created_models are incorrect with flush	David Cramer	nobody	"The `flush` command calls emit_post_sync_signal with all models, which is incorrect. This can send models as being ""created"" which actually don't even exist on a database.

For example, given that we have a database called `foo`, which does not contain django.contrib.sites, and we run the flush command, it will pass all installed models to the create_default_site method, even though Site isnt available here. With this behavior, Site then tries to create a row on this database which throws a table does not exist error.

This can be fixed by changing the flush command to match the syncdb command so that it only passes created_models which are present on this database:

e.g. (taken from syncdb)
{{{
        all_models = [
            (app.__name__.split('.')[-2],
                [m for m in models.get_models(app, include_auto_created=True)
                if router.allow_syncdb(db, m)])
            for app in models.get_apps()
        ]
}}}"		closed	Uncategorized	1.2		invalid			Unreviewed	0	0	0	0	0	0
