Tuesday, January 2, 2018

Re: How to convert Queryset to String?

if your title object has a __str__ then it can be printed.

Printing a queryset object make no sense!

HTH

Etienne


Le 2018-01-02 à 04:30, Joshua O. Morales a écrit :
title = Title.objects.filter(title=title)
print(title)
Is there a way to turn this:
<QuerySet[<Title: Hello, World>]>
into a string:
Hello, World



I tried using it as an argument but it gave me an error.

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9d47f644-68f6-4939-a0f2-65b4681701b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--   Etienne Robillard  tkadm30@yandex.com  https://www.isotopesoftware.ca/

No comments:

Post a Comment