Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgVol committed Aug 2, 2023
1 parent c2f6d1a commit 6963c71
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/api/management/commands/_importcsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ def import_csv():
with open(
os.path.join(FILE_DIR, 'ingredients.csv'), 'r', encoding='utf-8'
) as csvfile:
reader_ings = csv.reader(csvfile)
for row in reader_ings:
reader = csv.DictReader(csvfile)
for row in reader:
name, measurement_unit = row
Ingredient.objects.get_or_create(
name=name,
measurement_unit=measurement_unit
name=name, measurement_unit=measurement_unit
)
print(f'Файл {csvfile.name} загружен.')

Expand Down

0 comments on commit 6963c71

Please sign in to comment.