Opened 12 years ago

Closed 12 years ago

#18657 closed Bug (fixed)

Inconsistent db names in example

Reported by: msb@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: msb, stumbles Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

https://docs.djangoproject.com/en/1.4/topics/db/multi-db/

In the example, the names 'other' and 'credentials' are both used for a single database. It would make more sense if it stuck to just one name.

Correct this text:

With this setup installed, lets run some Django code:

>>> # This retrieval will be performed on the 'credentials' database
>>> fred = User.objects.get(username='fred')
>>> fred.first_name = 'Frederick'

>>> # This save will also be directed to 'credentials'
>>> fred.save()

to this:

With this setup installed, and assuming User is a model in myapp, lets run some Django code:

>>> # This retrieval will be performed on the 'other' database
>>> fred = User.objects.get(username='fred')
>>> fred.first_name = 'Frederick'

>>> # This save will also be directed to 'other'
>>> fred.save()

Change History (4)

comment:1 by Russell Keith-Magee, 12 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Agreed that the problem described exists; however, it looks like it's not the only example. The database name "users" also exists in the example code.

The whole page should be audited for errors of this nature.

comment:2 by msb, 12 years ago

Cc: msb added

Thanks russellm for looking so quickly. I agree that there is a case for making the whole page use the same examples, but I don't think that is essential. The first, simple example uses 'default' and 'users'. Then the more complex example at https://docs.djangoproject.com/en/1.4/topics/db/multi-db/#an-example uses 'other', 'master', 'slave1' and 'slave2', plus the stray 'credentials'. Simply fixing that would be a good start and enough to remove the inconsistency. HTH.

comment:3 by stumbles, 12 years ago

Cc: stumbles added

The database example chop and change a bit throughout the document, starting out with "default" and "users", then switching to "other", "master", "slave1" and "slave2" for the automatic routing examples, then switching back to simpler examples for manual routing.

Perhaps this page could be simplified by rearranging to discuss manual routing first. It could briefly mentioning that automatic routing is the easiest solution, but then discussi manual routing followed by the detail on automatic routing. Sound ok?

comment:4 by Marc Tamlyn, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top