Tuesday, June 24, 2014

Re: How do I Iterate database object querysets

          for lis in Licenses.objects.values('code'):
             for post_value in insert_data:     
                 if lis in post_value:
                         license_tag += insert_data[lis] + ','

so im trying that now but the problem is django is causing issues when iterating over a dictionary i think because its a post dictionary 

Exception Value:
coercing to Unicode: need string or buffer, dict found
Exception Location:/home/grant/workspace/Django Projects/trunk/holon/portal/views.py in portal, line 171


insert_data
<QueryDict: {u'vm_id_posted': [u'27381'], u'vm_group_name_posted': [u'Unassigned'], u'vm_name_posted': [u'HyTrust-ESXi01'], u'assign_customer': [u'61'], u'vm_datacenter_id_posted': [u'2'], u'vm_edit': [u'edit'], u'vm_mor_posted': [u'vm-8026'], u'save': [u'save'], u'INGVMWESXI': [u'INGVMWESXI'], u'insert': [u'yes'], u'customer_id': [u'1'], u'csrfmiddlewaretoken': [u'4e8g52f3Hj4GmzWpQlfL8YvdJrETNZ8k'], u'vm_group_id_posted': [u'1'], u'vm_id': [u'27390'], u'vm_vcd_managed_posted': [u'Y'], u'vm_display_name_posted': [u'HyTrust-ESXi01']}>


post_value
u'vm_id_posted'

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b4eb8f2f-e98a-437d-8656-1714f958af12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment