﻿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
18360	Database router example improvement	Simon Bächler	nobody	"In your example for a database router on https://docs.djangoproject.com/en/1.4/topics/db/multi-db/ there is one problem:
If you have several app accessing the 'other' database and multiple routers, the syncdb will not work for any app but the first one.

Currently it is:
{{{
class MyAppRouter(object):
    def allow_syncdb(self, db, model):
        ""Make sure the myapp app only appears on the 'other' db""
        if db == 'other':
            return model._meta.app_label == 'myapp'
        elif model._meta.app_label == 'myapp':
            return False
        return None
}}}
If the database is 'other' and the app_label is not 'myapp' the router returns False and syncdb won't work for all other routers for this db.

A better example would be:

{{{
    def allow_syncdb(self, db, model):
        if db == 'other' and model._meta.app_label == 'myapp':
            return True
        elif model._meta.app_label == 'myapp':
            return False
        return None
}}}

"	Cleanup/optimization	closed	Documentation	1.4	Normal	duplicate	multiple database	simon@…	Accepted	0	0	0	0	0	0
