#11106 closed (fixed)
typo in documentation?
| Reported by: | Maarten Nieber | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Keywords: | typo | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I think in http://docs.djangoproject.com/en/dev/topics/db/models/#topics-db-models
>>> Groups.objects.filter(members__name__startswith='Paul')
should be
>>> Group.objects.filter(members__name__startswith='Paul')
Moreover, memberships for paul and ringo are created differently:
m1 = Membership(person=ringo, group=beatles, date_joined=date(1962, 8, 16), invite_reason= "Needed a new drummer.") m2 = Membership.objects.create(person=paul, group=beatles, date_joined=date(1960, 8, 1), invite_reason= "Wanted to form a band.")
Only the second version (using Membership.objects.create) seems to work.
>>> for group in Group.objects.all(): ... print group.name ... print group.members.all() The Beatles [<Person: Paul McCartney>]
Attachments (1)
Change History (6)
comment:1 by , 16 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 16 years ago
> Moreover, memberships for paul and ringo are created differently: > > m1 = Membership(person=ringo, group=beatles, date_joined=date(1962, 8, 16), invite_reason= "Needed a new drummer.") > [...] > m2 = Membership.objects.create(person=paul, group=beatles, date_joined=date(1960, 8, 1), invite_reason= "Wanted to form a band.") > > Only the second version (using Membership.objects.create) seems to work.
That's because you forgot about the m1.save() just below the first line, x = Model(...); x.save() and Model.objects.create() are equivalent.
comment:3 by , 16 years ago
| Has patch: | set |
|---|---|
| Keywords: | typo added |
| Triage Stage: | Unreviewed → Ready for checkin |
comment:4 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:5 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
Fixed formatting.