﻿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
25514	Unique field - _perform_unique_checks problem	arannasousa		"Sorry for the bad English (translated via Google).

I have a correction suggest.

Currently working with different database without be 'default'.
One of my classes has a field with the 'unique = True' on.

When trying to make the register for a new item, via django.forms.ModelForm, page back me an error: ""Database of not exists"" (because is other database)

This was why the django was to perform a query from behind, to see if there is not any registered item that is equal to, but he did not know which database to look.


My suggestion is as follows:

'''version: 'development'
the file: 'django.db.models.base.py'
lines: 1006 and 1043'''

change from:
{{{#!python
qs = model_class._default_manager.filter(**lookup_kwargs)
}}}

to:
{{{#!python
qs = model_class._default_manager.using(getattr(self, 'db', None)).filter(**lookup_kwargs)
}}}

Thus, problems with UNIQUE fields in different banks 'default' ended"	Bug	closed	Database layer (models, ORM)	dev	Normal	duplicate	unique key checks		Unreviewed	0	0	0	0	0	0
