#15130: Model.validate_unique method is not considered with multi-db
------------------------+---------------------------------------------------
 Reporter:  t2y         |      Status:  new            
Milestone:  1.3         |   Component:  ORM aggregation
  Version:  1.2         |    Keywords:  multi-db       
    Stage:  Unreviewed  |   Has_patch:  1              
------------------------+---------------------------------------------------
 Model.validate_unique() method has 2 methods, _perform_unique_checks() and
 _perform_date_checks(), which use _default_manager for queryset. But, they
 are not considered with multi-db, that queryset is as follows.

 {{{
 qs = model_class._default_manager.filter(**lookup_kwargs)
 }}}

 I encountered a problem when ModelForm.is_valid() method is called since
 BaseModelForm calls full_clean() -> post_clean() -> validate_unique(). I
 could add/change/delete data with multi-db in AdminSite by setting
 arbitrary database with "using" keyword. However, the validation
 uniqueness check is invalid if default database has the same data.

 # see also[[BR]]
 http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-is-
 valid-method-and-errors [[BR]]
 http://docs.djangoproject.com/en/dev/ref/models/instances/#validating-
 objects

 I only tested default table operation in AdminSite applying attached
 patch.[[BR]]
 It works for me.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15130>
Django <http://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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to