Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11106 closed (fixed)

typo in documentation?

Reported by: mnieber Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: typo
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Alex)

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)

11106.diff (555 bytes) - added by timo 5 years ago.
typo

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by Alex

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Fixed formatting.

comment:2 Changed 5 years ago by ramiro

> 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.

Changed 5 years ago by timo

typo

comment:3 Changed 5 years ago by timo

  • Has patch set
  • Keywords typo added
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:4 Changed 5 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

(In [10797]) Fixed #11106 -- Corrected typo in models doc. Thanks mnieber.

comment:5 Changed 5 years ago by kmtracey

(In [10798]) [1.0.X] Fixed #11106 -- Corrected typo in models doc. Thanks mnieber.

r10797 from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.