Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a note about not using 'pk' as a field name for a non-primary-k…

…ey field.

git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6114 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4751fd9ba7dd761430be4b00b88221c6d2240f90 1 parent 2d07a19
@malcolmt malcolmt authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 docs/db-api.txt
View
5 docs/db-api.txt
@@ -1348,6 +1348,11 @@ equivalent::
Entry.objects.filter(blog__id=3) # __exact is implied
Entry.objects.filter(blog__pk=3) # __pk implies __id__exact
+.. note::
+ Because of this shortcut, you cannot have a field in your model called
+ ``pk`` that is not the primary key of the model. It will always be
+ replaced by the name of the model's primary key in queries.
+
Lookups that span relationships
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.