Django

Code

Ticket #4941: tutorial01.diff

File tutorial01.diff, 0.8 kB (added by John Shaffer <jshaffer2112@gmail.com>, 1 year ago)
  • tutorial01.txt

    old new  
    444444    [] 
    445445 
    446446    # Create a new Poll. 
    447     >>> from datetime import datetime 
    448     >>> p = Poll(question="What's up?", pub_date=datetime.now()) 
     447    >>> import datetime 
     448    >>> p = Poll(question="What's up?", pub_date=datetime.datetime.now()) 
    449449 
    450450    # Save the object into the database. You have to call save() explicitly. 
    451451    >>> p.save() 
     
    464464    datetime.datetime(2005, 7, 15, 12, 00, 53) 
    465465 
    466466    # Change values by changing the attributes, then calling save(). 
    467     >>> p.pub_date = datetime(2005, 4, 1, 0, 0) 
     467    >>> p.pub_date = datetime.datetime(2005, 4, 1, 0, 0) 
    468468    >>> p.save() 
    469469 
    470470    # objects.all() displays all the polls in the database.