#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.e0ea462008edf12cbf4429d4963c4702%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to