Clarifications for http://docs.djangoproject.com/en/dev/topics/db/queries/
The referenced class uses a capital E....
class Entry(models.Model)
But under "Saving ForeignKey and ManyToManyField fields",
a small E is used...
>>> entry.blog = cheese_blog
>>> entry.save()
Before the above line can be executed, there is also a missing import statement...
>>> from mysite.blog.models import *
Change History
(11)
| Description: |
modified (diff)
|
| Summary: |
Mistakes in http://docs.djangoproject.com/en/dev/topics/db/queries/ → Clarificications for http://docs.djangoproject.com/en/dev/topics/db/queries/
|
| Triage Stage: |
Unreviewed → Accepted
|
| Owner: |
changed from nobody to Derek Willis
|
| Status: |
new → assigned
|
| Has patch: |
set
|
| milestone: |
→ 1.3
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
| Summary: |
Clarificications for http://docs.djangoproject.com/en/dev/topics/db/queries/ → Clarifications for http://docs.djangoproject.com/en/dev/topics/db/queries/
|
(Fixed description formatting. Please use preview.)
The text in question is here: http://docs.djangoproject.com/en/dev/topics/db/queries/#saving-foreignkey-and-manytomanyfield-fields
The Entry/entry difference is not an error in the documentation. The lowercase-e
entryis assumed to be an instance of theEntryclass. The previous section on saving changes to an object makes that clear by noting whatb5is before using it in the example code, it would probably make sense to avoid confusion and note something similar beforeentryis used.The page does show an import for Blog, but not the other models used. In reading through the text, though, it's clear that the Blog import is done to show an example of how to do it; the remaining text assumes corresponding imports have been done for the other models used. It might not hurt to point that out in the text.