DetailView - invalid literal for int() with base 10:

89 views
Skip to first unread message

Barry Morrison

unread,
Jul 5, 2012, 5:07:23 AM7/5/12
to django...@googlegroups.com
I've been beating my head against this all night and now into the morning...I have NO idea what I'm doing wrong and Google and Stack Overflow haven't been as helpful as I had hoped. 

https://gist.github.com/7dc0b98a2fe056379ae8

Any help or guidance would be greatly appreciated!

Thanks!!

Jon Black

unread,
Jul 5, 2012, 5:13:59 AM7/5/12
to django...@googlegroups.com
I'm not sure without running it, which I can't do now. I have noticed that your slug is not and id, but the field PostSubReddit is a foerignkey which might expect an id.
 
Unrelated, I think your models shouldn't be pluralised (e.g. Post instead of Posts). If you want the table name to be plural, use the Meta class.
 
--
Jon Black
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zgmrTPX9yIEJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
 

Barry Morrison

unread,
Jul 5, 2012, 5:17:49 AM7/5/12
to django...@googlegroups.com
Apologies, here is the error output if it helps.

ValueError at /favs/Reddit/sysadmin/

invalid literal for int() with base 10: 'sysadmin'
Request Method: GET
Request URL: http://127.0.0.1:8000/favs/Reddit/sysadmin/
Django Version: 1.4
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: 'sysadmin'
Exception Location: /home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 537
Python Executable: /home/bmorriso/LocalRepository/Myosotis/venv/bin/python
Python Version: 2.7.3
Python Path:
['/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-packages/requests/packages',
 '/home/bmorriso/LocalRepository/Myosotis',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/plat-linux2',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-old',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/bmorriso/LocalRepository/Myosotis/venv/local/lib/python2.7/site-packages',
 '/home/bmorriso/LocalRepository/Myosotis/venv/lib/python2.7/site-packages']
Server time: Thu, 5 Jul 2012 02:03:21 -0700
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

Jon Black

unread,
Jul 5, 2012, 5:27:27 AM7/5/12
to django...@googlegroups.com
That doesn't help so much as there's no context information. Nice to see the 'sysadmin' bit which wasn't in your original post. Google throws up a lot of things for that:
 
 
--
Jon Black
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/aXIXIb3UGegJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.

Jon Black

unread,
Jul 5, 2012, 5:30:50 AM7/5/12
to django...@googlegroups.com
Hit send too soon then. My guess is that your kwargs being passed to filter() contains some suspect things.
--
Jon Black
Reply all
Reply to author
Forward
0 new messages