----------------------------------
Location: Chapter 5 Model
Problem description:
>>> P1 = publisher. objects. create (name = 'apache ',... address = '1970 Telegraph Avenue ',... city = 'berkeley ', state_province = 'CA', Country = 'U. s. a. ',... website = 'HTTP: // www.apress.com/')> P2 = publisher. objects. create (name = "O 'Reilly ",... address = '10 Fawcett St. ', city = 'cambridge ',... state_province = 'M', Country = 'U. s. a. ',... website = 'HTTP: // www.oreilly.com/') >>> publisher_list = publisher. objects. all () >>> publisher_list[<Publisher: Publisher Object>, <Publisher: Publisher Object>]
# When we print the entire publisher list, we do not get the desired useful information and cannot distinguish objects:
Add three models in mysite \ books \ modules_ Unicode __()Then you can see the effect:
>>> from books.models import Publisher>>> publisher_list = Publisher.objects.all()>>> publisher_list[<Publisher: Apress>, <Publisher: O‘Reilly>]
Error: add_ Unicode __()The method has no effect.
-------------------------- Split line --------------------------------------