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
--
Ticket URL: <https://code.djangoproject.com/ticket/25514>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* component: Uncategorized => Database layer (models, ORM)
* needs_tests: => 0
* type: Uncategorized => Bug
* needs_docs: => 0
* resolution: => duplicate
Comment:
Looks like a duplicate of #15130.
--
Ticket URL: <https://code.djangoproject.com/ticket/25514#comment:1>