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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to