top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is difference between values vs values_list in Django filter object ?

0 votes
426 views
What is difference between values vs values_list in Django filter object ?
posted Jan 30, 2019 by anonymous 1 abuse reported

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The values() method returns a QuerySet containing dictionaries:

<QuerySet [{'comment_id': 1}, {'comment_id': 2}]>

The values_list() method returns a QuerySet containing tuples:

<QuerySet [(1,), (2,)]>

If you are using values_list() with a single field, you can use flat=True to return a QuerySet of single values instead of 1-tuples:

<QuerySet [1, 2]>
answer Jan 31, 2019 by Aarati Mahajan
Similar Questions
0 votes

I'm new to Django. Is there any tell how to add a limit filter in Django?

+2 votes

Depending on the packet filter, it is decided to which bearer does the incoming packet belongs to. If TFT does this job, then what is the use of Pcc-Rule ?

Is it that Pcc-Rules are not matched in case of dedicated bearers as in dedicated bearer packet filter are already matched ?
Is it that DPI is done only for default bearer packets and decided to which pcc-rule is belongs to ?

Please help with reference to spec...

...