﻿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
15781	Multiple databases with same model names causing get errors	anonymous	Michael Radziej	"Code that causes the problem:

everyone.py: 
class Person(models.Model):
 emplid = models.CharField(max_length=15,primary_key=True)
 ... (other fields deleted)

    class Meta:
        app_label = u'everyone'
        db_tablespace = u'everyone'
        db_table = u'people_names'
        managed = False

people.py:
class Person(models.Model):
 emplid = models.CharField(max_length=11, db_column='emplid', primary_key=True
) ... (other fields deleted)

    class Meta:
        app_label = u'commons'
        db_tablespace = u'people'
        db_table = u'person'

The 2nd people.Person model is my default db, so #1 is ""everyone.Person"" and #2 is just ""Person"".

I tried (view.py):

try:
    person = everyone.Person.objects.get(pk=emplid)
except everyone.Person.DoesNotExist: # person not found by ""get""
    do some stuff

django complains in the 'except' : global name 'everyone' is not defined.

Apparently django does not support multi-database models in the same way as the default database. There is a work-around, but this behaviour then is inconsistent with default database models. Don't know if this is due to model names being the same."	Bug	closed	Uncategorized	1.2	Normal	invalid			Unreviewed	0	0	0	0	0	0
