hi
I have a model called Matchentry. It is this:
class Matchentry(models.Model):
tournament = models.ForeignKey(Tournament,verbose_name=_("Tournament"))
player = models.ForeignKey(Player,verbose_name=_("Player"))
class Meta:
unique_together = ("tournament", "player")
def __unicode__(self):
return u"%s: %s" %(self.player,self.tournament)
using ModelForm, I get this error:
ERROR: invalid input syntax for integer: "<QueryDict: {u'player': [u'3'],
u'csrfmiddlewaretoken': [u'8ba1dfc67c7bb739f8cf31e7566b3ef9'], u'tournament':
[u'1'], u'save': [u'Save']}>"
SELECT "web_matchentry"."id", "web_matchentry"."tournament_id",
"web_matchentry"."player_id" FROM "web_matchentry" WHERE
"web_matchentry"."tournament_id" = '<QueryDict: {u''player'': [u''3''],
u''csrfmiddlewaretoken'': [u''8ba1dfc67c7bb739f8cf31e7566b3ef9''],
u''tournament'': [u''1''], u''save'': [u''Save'']}>'
I cannot understand why it is not extracting the tournament_id. The full
traceback is here:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/addmatchentry/1/
Django Version: 1.2 alpha 1 SVN-12288
Python Version: 2.6.0
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'memootygolf.web']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/usr/lib/python2.6/django/core/handlers/base.py" in get_response
101. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.6/django/utils/decorators.py" in __call__
36. return self.decorator(self.func)(*args, **kwargs)
File "/usr/lib/python2.6/django/contrib/auth/decorators.py" in _wrapped_view
24. return view_func(request, *args, **kwargs)
File "/home/lawgon/memootygolf/../memootygolf/web/views.py" in addmatchentry
599. form = Matchentryform(request.POST,instance=instance)
File "/home/lawgon/memootygolf/../memootygolf/web/views.py" in __init__
575. for x in self.tr:
File "/usr/lib/python2.6/django/db/models/query.py" in _result_iter
104. self._fill_cache()
File "/usr/lib/python2.6/django/db/models/query.py" in _fill_cache
755. self._result_cache.append(self._iter.next())
File "/usr/lib/python2.6/django/db/models/query.py" in iterator
267. for row in compiler.results_iter():
File "/usr/lib/python2.6/django/db/models/sql/compiler.py" in results_iter
619. for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.6/django/db/models/sql/compiler.py" in execute_sql
674. cursor.execute(sql, params)
File "/usr/lib/python2.6/django/db/backends/util.py" in execute
19. return self.cursor.execute(sql, params)
File "/usr/lib/python2.6/django/db/backends/postgresql/base.py" in execute
53. return self.cursor.execute(smart_str(sql, self.charset),
self.format_params(params))
Exception Type: ProgrammingError at /addmatchentry/1/
Exception Value: ERROR: invalid input syntax for integer: "<QueryDict:
{u'player': [u'3'], u'csrfmiddlewaretoken':
[u'8ba1dfc67c7bb739f8cf31e7566b3ef9'], u'tournament': [u'1'], u'save':
[u'Save']}>"
SELECT "web_matchentry"."id", "web_matchentry"."tournament_id",
"web_matchentry"."player_id" FROM "web_matchentry" WHERE
"web_matchentry"."tournament_id" = '<QueryDict: {u''player'': [u''3''],
u''csrfmiddlewaretoken'': [u''8ba1dfc67c7bb739f8cf31e7566b3ef9''],
u''tournament'': [u''1''], u''save'': [u''Save'']}>'
--
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/
--
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.