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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -