如果
title和
body是模型中的字段,则可以使用**运算符将关键字参数传递到字典中。
假设你的模型称为MyModel:
# create instance of modelm = MyModel(**data_dict)# don't forget to save to database!m.save()
至于第二个问题,字典必须是最后一个参数。同样,
extra并且
extra2应该是模型中的字段。
m2 =MyModel(extra='hello', extra2='world', **data_dict)m2.save()



