python - How do I use django db API to save all the elements of a given column in a dictionary? -


i've used raw sql query access them, , seems have worked. however, can't figure out way print results array. thing can find cursor.fetchone() command, gives me single row.

is there way can return entire column in django query set?

dict(mymodel.objects.values_list('id', 'my_column')) return dictionary elements of my_column row's id key. you're looking list of values, should receive via mymodel.objects.values_list('my_column', flat=true)!


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -