Because its a foreign field either get an instance of Listings with that
id like:
listening = Listings.objects.get(id=15)
CanoeKayak.listings = listening
or to add directly a value:
CanoeKayak.listings_id = 15
Am 04.01.2012 04:46, schrieb BillB1951:
I am trying to add the interger value 15 to a table field
CanoeKayak.listings, which is a Foreignkey field that is related to
the "Listings.id" field in another table --- a listings.id=15 exists.
What is happening?
see error below:
ValueError at /bsmain/canoekayak/add/15/
Cannot assign "[15]":"CanoeKayak.listings" must be a "Listings"
instance.
Request Method: POST
Request URL: http://127.0.0.1:8000/bsmain/canoekayak/add/15/
Django Version: 1.3.1
Exception Type: ValueError
Exception Value:
Cannot assign "[15]": "CanoeKayak.listings" must be a "Listings"
instance.
Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/
models/fields/related.py in __set__, line 331
Python Executable: /usr/bin/python
Python Version: 2.6.5
Python Path:
['/home/bill/workspace/boatsite',
'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/usr/lib/pymodules/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.6/gtk-2.0',
'/usr/local/lib/python2.6/dist-packages']
Server time: Tue, 3 Jan 2012 21:33:38 -0600
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.