Mytable.objects.values('f1', 'f2')

On Fri, Jan 10, 2020, 7:22 PM Klaus Laube <[email protected]> wrote:

> I'm not sure if I got your question right, but I guess `values()` is what
> you are looking for:
> https://docs.djangoproject.com/en/3.0/ref/models/querysets/#values
>
> From the documentation:
>
>> The values() method takes optional positional arguments, *fields, which
>> specify field names to which the SELECT should be limited. If you specify
>> the fields, each dictionary will contain only the field keys/values for the
>> fields you specify. If you don’t specify the fields, each dictionary will
>> contain a key and value for every field in the database table.
>
>
> Em sex., 10 de jan. de 2020 às 09:37, Mohsen Pahlevanzadeh <
> [email protected]> escreveu:
>
>> Hello everybody,
>>
>>
>> I can write a query with django if I have : "select * from mytable;"
>> But if I have a field , I can write, such as "select f1,f2 from mytable;"
>>
>> Please help me.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/dda9aa1f-6f6b-451a-84b6-626397d2d95f%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/dda9aa1f-6f6b-451a-84b6-626397d2d95f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE89-bdNrrXzPN%2BSO7TFiYhrfpaHdKotftJaJfVacFy7L6m1Nw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE89-bdNrrXzPN%2BSO7TFiYhrfpaHdKotftJaJfVacFy7L6m1Nw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADwyzwoipjzJewbDA7MEjx%3DAW-dwO3T1%3D0jQGhp7T9FhHB44mg%40mail.gmail.com.

Reply via email to