#15875 closed Bug (fixed)
F() example in db queries topic guide has an error
| Reported by: | Jeff Blaine | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.3 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
http://docs.djangoproject.com/en/1.3/topics/db/queries/#filters-can-reference-fields-on-the-model
I'm thinking this is incorrect. The F() object references the pingback count, no?
For example, to find a list of all blog entries that have had more comments than
pingbacks, we construct an F() object to reference the comment count, and use
that F() object in the query:
>>> from django.db.models import F
>>> Entry.objects.filter(n_comments__gt=F('n_pingbacks'))
Attachments (1)
Change History (6)
comment:1 by , 15 years ago
| Easy pickings: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
| Attachment: | 15875.diff added |
|---|
comment:2 by , 15 years ago
| Has patch: | set |
|---|
comment:3 by , 15 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:4 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In [16096]:
(The changeset message doesn't reference this ticket)