Merge "create_object should not add an ID if not present in the DB model"
This commit is contained in:
commit
f40538e629
@ -105,7 +105,7 @@ def get_objects(context, model, **kwargs):
|
|||||||
|
|
||||||
def create_object(context, model, values):
|
def create_object(context, model, values):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
if 'id' not in values:
|
if 'id' not in values and hasattr(model, 'id'):
|
||||||
values['id'] = uuidutils.generate_uuid()
|
values['id'] = uuidutils.generate_uuid()
|
||||||
db_obj = model(**values)
|
db_obj = model(**values)
|
||||||
context.session.add(db_obj)
|
context.session.add(db_obj)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user