mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
fixed food create
This commit is contained in:
@@ -364,14 +364,14 @@ class OpenDataImporter:
|
|||||||
else:
|
else:
|
||||||
od_response.total_untouched += 1
|
od_response.total_untouched += 1
|
||||||
else:
|
else:
|
||||||
create_list.append(obj_dict)
|
create_list.append({'data': obj_dict})
|
||||||
|
|
||||||
if self.update_existing and len(update_list) > 0:
|
if self.update_existing and len(update_list) > 0:
|
||||||
model_type.objects.bulk_update(update_list, field_list)
|
model_type.objects.bulk_update(update_list, field_list)
|
||||||
od_response.total_updated += len(update_list)
|
od_response.total_updated += len(update_list)
|
||||||
|
|
||||||
if len(create_list) > 0:
|
if len(create_list) > 0:
|
||||||
model_type.objects.bulk_create(create_list, update_conflicts=True, update_fields=field_list, unique_fields=('space', 'name',))
|
Food.load_bulk(create_list, None)
|
||||||
od_response.total_created += len(create_list)
|
od_response.total_created += len(create_list)
|
||||||
|
|
||||||
# --------------- PROPERTY STUFF -----------------------
|
# --------------- PROPERTY STUFF -----------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user