diff --git a/ihatemoney/models.py b/ihatemoney/models.py index ef3f5c87..50f919b4 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -322,7 +322,7 @@ class Project(db.Model): db.session.add(self) db.session.commit() - def import_bills(self, bills: list[dict]): + def import_bills(self, bills: list): """Import bills from a list of dictionaries""" # Add members not already in the project members_project = [str(m) for m in self.members] @@ -621,14 +621,14 @@ class Bill(db.Model): def __init__( self, amount: float, - date: object = None, + date: datetime = None, external_link: str = "", original_currency: str = "", - owers: list[Person] = [], + owers: list = [], payer_id: int = None, project_default_currency: str = "", what: str = "", - ) -> None: + ): super().__init__() self.amount = amount self.date = date diff --git a/ihatemoney/tests/main_test.py b/ihatemoney/tests/main_test.py index bd5e7ddc..fac655d3 100644 --- a/ihatemoney/tests/main_test.py +++ b/ihatemoney/tests/main_test.py @@ -153,7 +153,7 @@ class ModelsTestCase(IhatemoneyTestCase): }, ) - project = self.get_project_by_name(name="raclette") + project = models.Project.query.get_by_name(name="raclette") zorglub = models.Person.query.get_by_name(name="zorglub", project=project) zorglub_bills = models.Bill.query.options( orm.subqueryload(models.Bill.owers) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index f0d8d709..02d73648 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -13,7 +13,6 @@ from functools import wraps import json import os -from dateutil.parser import parse from dateutil.relativedelta import relativedelta from flask import ( Blueprint, @@ -454,7 +453,7 @@ def import_project(): elif data.mimetype == "text/csv": try: bills = csv2list_of_dicts(data) - except Exception as b: + except Exception: raise ValueError(_("Unable to parse CSV")) else: raise ValueError("Unsupported file type") @@ -484,7 +483,8 @@ def import_project(): if len(currencies - {CurrencyConverter.no_currency}) >= 2: raise ValueError( _( - "Cannot add bills in multiple currencies to a project without default currency" + "Cannot add bills in multiple currencies to a project without default " + "currency" ) ) # Strip currency from bills (since it's the same for every bill)