1👍
✅
Have you tried this?
return table(*row)
I think a better practice is to pass keyword-args when creating a Model object. If you already have field names in a list fields
, you can do:
return table(**dict(zip(fields, row)))
If you don’t, you can grab it using something like:
fields = [ f.name for f in ab._meta.fields ]
(You might choose to filter out the id
field).
By the way, table([x for x in row])
is the same as table(row)
(except that it doesn’t created a copy, but in this case it shouldn’t matter).
👤shx2
Source:stackexchange.com