Django book learning problem records

Source: Internet
Author: User

----------------------------------

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 --------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.