Reputation: 8836
You can create a new model in App Engine using a dictionary:
my_model = MyModel.get_or_insert(keyname, **kwargs)
Is there a way to update a model using a dictionary instead of doing the following?
my_model.firstprop = 'first'
my_model.secondprop = 'second'
Upvotes: 2
Views: 534
Reputation: 101149
There's no built in method to do this, but writing your own is straightforward:
def update_model(model, values):
for k, v in values.iteritems():
setattr(model, k, v)
Upvotes: 6