[Django] #25514: Unique field - _perform_unique_checks problem

5 views
Skip to first unread message

Django

unread,
Oct 6, 2015, 9:57:10 AM10/6/15
to django-...@googlegroups.com
#25514: Unique field - _perform_unique_checks problem
-------------------------------+-------------------------------
Reporter: arannasousa | Owner:
Type: Uncategorized | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords: unique key checks
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/25514>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 6, 2015, 10:53:18 AM10/6/15
to django-...@googlegroups.com
#25514: Unique field - _perform_unique_checks problem
-------------------------------------+-------------------------------------
Reporter: arannasousa | Owner:
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: unique key checks | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* 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>

Reply all
Reply to author
Forward
0 new messages