Django Database Get value

Source: Internet
Author: User
The contents of the database table are as follows:


Models. Step_Type.objects.values ()
Gets the qualified value in the model, actually querying all the values in the table, such as the query result:
<queryset [{' id ': 1, ' step_type ': ' comment '}, {' id ': 2, ' step_type ': ' Call '}, {' id ': 3, ' step_type ': ' Log '}]>

Models. Step_Type.objects.values (). filter (id=1) [0]
Getting the first value that matches the condition results in the following:
<queryset [{' id ': 1, ' step_type ': ' Comment '}]>

Models. Step_Type.objects.values ("Step_type"). Filter (id=1)
Get field values
<queryset [{' Step_type ': ' Comment '}]>






Django Database Get value

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.