From b093489c77eb52a8b0f0c328ca3b0c07fc586975 Mon Sep 17 00:00:00 2001 From: Andreas Madsack Date: Sat, 3 Mar 2018 18:57:54 +0100 Subject: [PATCH] add MEDIA_ROOT in front of filename --- byro_shackspace/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/byro_shackspace/utils.py b/byro_shackspace/utils.py index d68876b..7c7f3c4 100644 --- a/byro_shackspace/utils.py +++ b/byro_shackspace/utils.py @@ -1,10 +1,12 @@ import csv +import os.path import re from datetime import datetime from decimal import Decimal from django.dispatch import receiver from django.utils.timezone import now +from django.conf import settings from byro.bookkeeping.models import ( Account, AccountCategory, RealTransaction, @@ -19,7 +21,8 @@ from byro.members.models import Member @receiver(process_csv_upload) def process_bank_csv(sender, signal, **kwargs): source = sender - reader = csv.DictReader(open(source.source_file.name, encoding='iso-8859-1'), delimiter=';', quotechar='"') + filename = os.path.join(settings.MEDIA_ROOT, source.source_file.name) + reader = csv.DictReader(open(filename, encoding='iso-8859-1'), delimiter=';', quotechar='"') booking_timestamp = now() for line in reader: