Wednesday, February 26, 2020

Django values_list queryset returns queryset object instead of list

Hi,
I have a table named View, I'm filtering values like this : views = View.objects.all().values_list('name',flat=True).order_by('id')
I get the output as <QuerySet ['lib', 'lef', 'models', 'datasheet', 'layout', 'gds', 'netlist', 'gds2def', 'symbol']> instead of list of the names. So I face error when try to parse it in jquery : jQuery.parseJSON(JSON.stringify("{{views|safe}}".replace(/&#39;/g, '"').replace(/u&quot;/g, '"').replace(/&quot;/g, '"'))); it gives me the result as  ------ > <QuerySet ['lib', 'lef', 'models', 'datasheet', 'layout', 'gds', 'netlist', 'gds2def', 'symbol']> .

How to fix this? Appreciating any help.


Regards,
Santhosh

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/93ee9e2e-4f23-4de5-bd31-3dba75d5d26b%40googlegroups.com.

No comments:

Post a Comment