﻿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
28707	Model.validate_unique() method doesn't take in account multi-db	coulix	nobody	"In a multi-db configuration it seems that constraints such as model field  **unique=True** does always target the **default** db in the Django admin. It ignores the **MultiDBModelAdmin** way as explained here https://docs.djangoproject.com/en/1.11/topics/db/multi-db/#exposing-multiple-databases-in-django-s-admin-interface.

Digging a bit I see the **_perform_unique_checks** method here that does not seem to be able to take an other db connection than the default.

https://github.com/django/django/blob/fb02ebe889eee292144f9157ed4ddcdcc139eba9/django/db/models/base.py#L1005

{{{
 qs = model_class._default_manager.filter(**lookup_kwargs)
}}}

For now I am going to use my own validator on save but either I am doing it wrong or there is a bug / doc update that needs attention.
"	Bug	closed	Database layer (models, ORM)	1.11	Normal	duplicate	multidb admin uniqueness		Unreviewed	0	0	0	0	0	0
