Hi,

I try to add some data through the Admin interface but I get an SQL
Error when I try to add a ManyToMany Relation.

The model:
class Artist(models.Model):
    name = models.CharField(max_length=200, blank=True)
    abstract = models.TextField(blank=True, help_text=_('Give a short
introduction about your music.'))
    logo = UserImageField(upload_to='%(base_path)s/Artist/Logo/',
blank=True)
    image = UserImageField(upload_to='%(base_path)s/Artist/Image/',
blank=True)
    myspace_link = models.URLField(verify_exists=True, blank=True,
help_text=_('You can specify your MySpace link here.'))
    youtube_link = models.URLField(verify_exists=True, blank=True,
help_text=_('You can specify a link to your Youtube videos here.'))
    home_dir = models.CharField(max_length=200, editable=False)
    slug = models.SlugField(prepopulate_from=('members', 'name'))
    members = models.ManyToManyField(User, unique=True,
related_name='users_artist_members')
    fans = models.ManyToManyField(User, blank=True, unique=True,
symmetrical=False, related_name='users_artist_fans')

The Traceback:
Environment:

Request Method: POST
Request URL: http://localhost:8030/admin/users/artist/add/
Django Version: 0.97-pre-SVN-unknown
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.webdesign',
 'django.contrib.comments',
 'fetchedup.schedule',
 'fetchedup.users',
 'fetchedup.music',
 'fetchedup.registration']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'fetchedup.middleware.threadlocals.ThreadLocals')


Traceback:
File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
in get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
decorators.py" in _checklogin
  56.             return view_func(request, *args, **kwargs)
File "/Library/Python/2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  39.         response = view_func(request, *args, **kwargs)
File "/Library/Python/2.5/site-packages/django/contrib/admin/views/
main.py" in add_stage
  260.         errors = manipulator.get_validation_errors(new_data)
File "/Library/Python/2.5/site-packages/django/oldforms/__init__.py"
in get_validation_errors
  62.             errors.update(field.get_validation_errors(new_data))
File "/Library/Python/2.5/site-packages/django/oldforms/__init__.py"
in get_validation_errors
  379.                     self.run_validator(new_data, validator)
File "/Library/Python/2.5/site-packages/django/oldforms/__init__.py"
in run_validator
  367.                 validator(new_data.getlist(self.field_name),
new_data)
File "/Library/Python/2.5/site-packages/django/utils/functional.py" in
_curried
  3.         return _curried_func(*(args+moreargs), **dict(kwargs,
**morekwargs))
File "/Library/Python/2.5/site-packages/django/db/models/fields/
__init__.py" in manipulator_validator_unique
  47.         old_obj = self.manager.get(**{lookup_type: field_data})
File "/Library/Python/2.5/site-packages/django/db/models/manager.py"
in get
  69.         return self.get_query_set().get(*args, **kwargs)
File "/Library/Python/2.5/site-packages/django/db/models/query.py" in
get
  261.         obj_list = list(clone)
File "/Library/Python/2.5/site-packages/django/db/models/query.py" in
__iter__
  114.         return iter(self._get_data())
File "/Library/Python/2.5/site-packages/django/db/models/query.py" in
_get_data
  483.             self._result_cache = list(self.iterator())
File "/Library/Python/2.5/site-packages/django/db/models/query.py" in
iterator
  189.         cursor.execute("SELECT " + (self._distinct and
"DISTINCT " or "") + ",".join(select) + sql, params)
File "/Library/Python/2.5/site-packages/django/db/backends/util.py" in
execute
  18.             return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /admin/users/artist/add/
Exception Value: operator does not exist: integer = text[]
LINE 1: ..._id" WHERE ("m2m_users_artist__members"."user_id" =
ARRAY['2...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You
may need to add explicit type casts.

Many thanks for your help!
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to