get_or_create and foreign keys

310 views
Skip to first unread message

Thierry

unread,
Apr 28, 2008, 3:12:14 PM4/28/08
to Django users
The get or create syntax does not appear to support the following
syntax:

object, created = get_or_create(entity_id = 12)

it fails on the _id part.
is there anyway to give it numbers instead of objects?

davenaff

unread,
Apr 28, 2008, 9:55:48 PM4/28/08
to Django users
This might be a syntax problem. This is the syntax I use:

object, created = Entity.objects.get_or_create(id=12)
Reply all
Reply to author
Forward
0 new messages