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++ - Is it possible to compile a VST on linux? -

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

php cli reading files and how to fix it? -