Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #1724 -- updated the output from the shell commands to match wh…

…at we now

produce.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2937 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ce6f058bbb79e9b9eae198b066c6db6eb0683a21 1 parent 98d6eac
Malcolm Tredinnick authored May 18, 2006

Showing 1 changed file with 16 additions and 16 deletions. Show diff stats Hide diff stats

  1. 32  docs/tutorial01.txt
32  docs/tutorial01.txt
@@ -445,13 +445,13 @@ Once you're in the shell, explore the database API::
445 445
 
446 446
     # objects.all() displays all the polls in the database.
447 447
     >>> Poll.objects.all()
448  
-    [<Poll object>]
  448
+    [<Poll: Poll object>]
449 449
 
450 450
 
451  
-Wait a minute. ``<Poll object>`` is, utterly, an unhelpful representation of
452  
-this object. Let's fix that by editing the polls model
453  
-(in the ``polls/models.py`` file) and adding a ``__str__()`` method to
454  
-both ``Poll`` and ``Choice``::
  451
+Wait a minute. ``<Poll: Poll object>`` is, utterly, an unhelpful
  452
+representation of this object. Let's fix that by editing the polls model (in
  453
+the ``polls/models.py`` file) and adding a ``__str__()`` method to both
  454
+``Poll`` and ``Choice``::
455 455
 
456 456
     class Poll(models.Model):
457 457
         # ...
@@ -487,30 +487,30 @@ Let's jump back into the Python interactive shell by running
487 487
 
488 488
     # Make sure our __str__() addition worked.
489 489
     >>> Poll.objects.all()
490  
-    [What's up?]
  490
+    [<Poll: What's up?>]
491 491
 
492 492
     # Django provides a rich database lookup API that's entirely driven by
493 493
     # keyword arguments.
494 494
     >>> Poll.objects.filter(id=1)
495  
-    [What's up?]
  495
+    [<Poll: What's up?>]
496 496
     >>> Poll.objects.filter(question__startswith='What')
497  
-    [What's up?]
  497
+    [<Poll: What's up?>]
498 498
 
499 499
     # Get the poll whose year is 2005. Of course, if you're going through this
500 500
     # tutorial in another year, change as appropriate.
501 501
     >>> Poll.objects.get(pub_date__year=2005)
502  
-    What's up?
  502
+    <Poll: What's up?>
503 503
 
504 504
     >>> Poll.objects.get(id=2)
505 505
     Traceback (most recent call last):
506 506
         ...
507  
-    DoesNotExist: Poll does not exist for {'id': 2}
  507
+    DoesNotExist: Poll matching query does not exist.
508 508
 
509 509
     # Lookup by a primary key is the most common case, so Django provides a
510 510
     # shortcut for primary-key exact lookups.
511 511
     # The following is identical to Poll.objects.get(id=1).
512 512
     >>> Poll.objects.get(pk=1)
513  
-    What's up?
  513
+    <Poll: What's up?>
514 514
 
515 515
     # Make sure our custom method worked.
516 516
     >>> p = Poll.objects.get(pk=1)
@@ -522,18 +522,18 @@ Let's jump back into the Python interactive shell by running
522 522
     # of available choices and returns the new Choice object.
523 523
     >>> p = Poll.objects.get(pk=1)
524 524
     >>> p.choice_set.create(choice='Not much', votes=0)
525  
-    Not much
  525
+    <Choice: Not much>
526 526
     >>> p.choice_set.create(choice='The sky', votes=0)
527  
-    The sky
  527
+    <Choice: The sky>
528 528
     >>> c = p.choice_set.create(choice='Just hacking again', votes=0)
529 529
 
530 530
     # Choice objects have API access to their related Poll objects.
531 531
     >>> c.poll
532  
-    What's up?
  532
+    <Poll: What's up?>
533 533
 
534 534
     # And vice versa: Poll objects get access to Choice objects.
535 535
     >>> p.choice_set.all()
536  
-    [Not much, The sky, Just hacking again]
  536
+    [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]
537 537
     >>> p.choice_set.count()
538 538
     3
539 539
 
@@ -542,7 +542,7 @@ Let's jump back into the Python interactive shell by running
542 542
     # This works as many levels deep as you want. There's no limit.
543 543
     # Find all Choices for any poll whose pub_date is in 2005.
544 544
     >>> Choice.objects.filter(poll__pub_date__year=2005)
545  
-    [Not much, The sky, Just hacking again]
  545
+    [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]
546 546
 
547 547
     # Let's delete one of the choices. Use delete() for that.
548 548
     >>> c = p.choice_set.filter(choice__startswith='Just hacking')

0 notes on commit ce6f058

Please sign in to comment.
Something went wrong with that request. Please try again.