I have a simple model I am inserting into. I am using the following syntax:
m = Model.objects.raw("insert into my_model (col) values ('test') returning *")
In postgres, this returns the identical columns that : select * from my_model where col = 'test' limit 1; would return. However, I am unable to get this to work. I had to resort to:
m Model(col='test')
m.save()
m = Model.objects.get(id = m.id)
I could also try the raw cursor syntax, but, it seems that the raw should work because the columns being returned map directly on to the model whose raw() I am using.