﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20217	query model using `filter` or `get` occur ValueError: invalid literal for int() with base 10	592280502@…	nobody	"class User(models.Model):
    identifier=models.CharField(max_length=128, unique=True, db_index=True)
    ..........
    ..........

class Token(models.Model):
    user = models.ForeignKey(""User"", related_name=""Tokens"")
    token_string = models.CharField(max_length=128, unique=True, db_index=True)

while I already have a tk(<Token object>),I run this:
    user = User.objects.filter(id=tk.user_id) if user: user = user[0]
it cause the ValueError: invalid literal for int() with base 10:
File ""/usr/local/lib/python2.7/site-packages/django/db/models/query.py"", line 113, in __nonzero__
    iter(self).next()
  File ""/usr/local/lib/python2.7/site-packages/django/db/models/query.py"", line 107, in _result_iter
    self._fill_cache()
  File ""/usr/local/lib/python2.7/site-packages/django/db/models/query.py"", line 772, in _fill_cache
    self._result_cache.append(self._iter.next())
  File ""/usr/local/lib/python2.7/site-packages/django/db/models/query.py"", line 273, in iterator
    for row in compiler.results_iter():
  File ""/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py"", line 680, in results_iter
    for rows in self.execute_sql(MULTI):
  File ""/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py"", line 735, in execute_sql
    cursor.execute(sql, params)
  File ""/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py"", line 86, in execute
    return self.cursor.execute(query, args)
  File ""build/bdist.linux-x86_64/egg/MySQLdb/cursors.py"", line 174, in execute
    self.errorhandler(self, exc, value)
  File ""build/bdist.linux-x86_64/egg/MySQLdb/connections.py"", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ValueError: invalid literal for int() with base 10: '\xd9'
but it disappeared when I restart my project, but a couple of days while running, it occured again
How does it happened and any solutions?"	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid			Unreviewed	0	0	0	0	0	0
