2020-10-17 21:51:38 +02:00
|
|
|
def set_custom_fields_values(entity, custom_field_data):
|
2021-02-08 11:59:33 +01:00
|
|
|
if not custom_field_data:
|
|
|
|
return
|
|
|
|
|
|
|
|
entity.custom_field_data = custom_field_data
|
|
|
|
return entity.save()
|
2020-10-17 21:51:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
def pop_custom_fields(params):
|
2021-02-08 11:59:33 +01:00
|
|
|
if "custom_field_data" in params:
|
|
|
|
return params.pop("custom_field_data")
|
|
|
|
elif "custom_fields" in params:
|
|
|
|
print("⚠️ Please rename 'custom_fields' to 'custom_field_data'!")
|
|
|
|
return params.pop("custom_fields")
|
2020-10-17 21:51:38 +02:00
|
|
|
|
2021-02-08 11:59:33 +01:00
|
|
|
return None
|