Thanks for your answer. Unfortunatelly I get the same error using
DATABASES dict.

It is actually very strange. After I had used pdb and went through the
code slowly there were no error! However during normal execution there
is still a problem. I found that something goes wrong inside
allow_relation method in django.db.utils. Last line of this function
is:
        return obj1._state.db == obj2._state.db

But when I print these variables i get:

without pdb:
obj1._state.db:  None
obj2._state.db:  default

with pdb (I mean step by step execution):
obj1._state.db:  default
obj2._state.db:  default

:/


On 4 Mar, 15:48, Matt McCants <mattmcca...@gmail.com> wrote:
> Check out your database settings. 1.2 adds Multi-DB support and with it a
> new way of specifying databases, now it shouldn't be causing issues, since
> the pre-1.2 way of specifying a database is going to be supported until 1.4,
> it would still be where I started my debugging since it looks like Django
> thinks your objects are on two different databases.
>
> Check 
> out:http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#specifying...
> andhttp://docs.djangoproject.com/en/dev/ref/settings/#databases
>
>
>
> On Thu, Mar 4, 2010 at 8:54 AM, eXt <restless.be...@gmail.com> wrote:
> > Hi!
>
> >   I've upgraded my Django to 1.2 (1.2-beta-1, tried also trunk) and
> > after that my application has started to throw an exception:
> > ValueError: Cannot add "<User: XXX>": instance is on database
> > "default", value is is on database "None".
>
> > The code causing the problem is:
>
> > (...)
> > project = form.save()
> > admin_profiles =
> > Member.objects.select_related().filter(group__name='Admin')
> > for admin_profile in admin_profiles:
> >    project.users.add(admin_profile.user)
>
> > It is just adding users to a project.users which is m2m to auth.User.
> > Error report is:
>
> > Traceback (most recent call last):
>
> >  File "/var/www/django/someapp/parts/django/django/core/handlers/
> > base.py", line 101, in get_response
> >   response = callback(request, *callback_args, **callback_kwargs)
>
> >  File "/var/www/django/someapp/webshare/utils.py", line 21, in wrapper
> >   context = view_func(*args, **kwargs)
>
> >  File "/var/www/django/someapp/webshare/apps/projects/views.py", line
> > 100, in add_project
> >   project.users.add(admin_profile.user)
>
> >  File "/var/www/django/someapp/parts/django/django/db/models/fields/
> > related.py", line 465, in add
> >   self._add_items(self.source_field_name, self.target_field_name,
> > *objs)
>
> >  File "/var/www/django/someapp/parts/django/django/db/models/fields/
> > related.py", line 525, in _add_items
> >   (obj, self.instance._state.db, obj._state.db))
>
> > ValueError: Cannot add "<User: XXX>": instance is on database
> > "default", value is is on database "None"
>
> > Everything is ok when I go back to Django 1.1.1. Is there something
> > I've missed in my configuration or it's a bug?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@google 
> > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to