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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -