开发者

Django: function get_model with a tuple

开发者 https://www.devze.com 2023-02-10 01:43 出处:网络
The django function get_model() takes an app name and model, but I was curious as to whether you can us it with a tuple

The django function get_model() takes an app name and model, but I was curious as to whether you can us it with a tuple

i.e. something like

get_model(('app','model'))

Thanks, sorry if this is basi开发者_如何转开发c


Why not? it's python! Expand your tuple with *

get_model(*('app', 'model'))

0

精彩评论

暂无评论...
验证码 换一张
取 消