Opened 11 years ago

Closed 11 years ago

#20261 closed Uncategorized (duplicate)

Changing a Site fails if the user has a string ID.

Reported by: Stavros Korokithakis Owned by: nobody
Component: Uncategorized Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm running Django 1.5 and have a custom User model that has a string ID field. When I try to change a site, I get the following error:

Environment:


Request Method: POST
Request URL: http://staging.getinstabot.com/narnia/sites/site/1/

Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django_browserid',
 'django_extensions',
 'django_forms_bootstrap',
 'backend',
 'loginas',
 'south',
 'gunicorn',
 'mediagenerator',
 'main']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'middleware.InterstitialMiddleware')


Traceback:
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  372.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  202.             return view(request, *args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223.                 return func(*args, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in change_view
  1108.                 self.log_change(request, new_object, change_message)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in log_change
  546.             change_message  = message
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/contrib/admin/models.py" in log_action
  19.         e.save()
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  546.                        force_update=force_update, update_fields=update_fields)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  650.                 result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in _insert
  215.         return insert_query(self.model, objs, fields, **kwargs)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/models/query.py" in insert_query
  1673.     return query.get_compiler(using=using).execute_sql(return_id)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  937.             cursor.execute(sql, params)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  41.             return self.cursor.execute(sql, params)
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py" in execute
  58.             six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/var/projects/instabot/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py" in execute
  54.             return self.cursor.execute(query, args)

Exception Type: DatabaseError at /narnia/sites/site/1/
Exception Value: invalid input syntax for integer: "MZuPQW"
LINE 1: ...e_message") VALUES ('2013-04-14 20:44:29.115961', 'MZuPQW', ...
                                                             ^

Is there a workaround for this for now? It's pretty serious...

Change History (1)

comment:1 by Russell Keith-Magee, 11 years ago

Resolution: duplicate
Status: newclosed

This is a known and documented limitation of Django's User system

#14881 tracks the underlying problem.

Note: See TracTickets for help on using tickets.
Back to Top