python - Django primary key -
when querying in django people.objects.all(pk=code)
, pk=code
mean?
it's query people object has primary key of whatever value of "code" is.
by default, django model instances have primary key uniquely identifies object. it's auto-incrementing integer, define whatever want, long it's unique.
http://docs.djangoproject.com/en/dev/topics/db/models/#id1
edit: @ code snippet little closer, rather assuming said, doesn't make sense. all() method should get(). doesn't make sense give pk all() since returns objects of type.
http://docs.djangoproject.com/en/dev/ref/models/querysets/#all http://docs.djangoproject.com/en/dev/ref/models/querysets/#id5
Comments
Post a Comment