17 lines
629 B
Python
17 lines
629 B
Python
from verein import Verein
|
|
|
|
TABLE_HEADING = "account_name,address,post_code,city,total_balance,available_balance,redeemed"
|
|
|
|
|
|
def export_vereine(vereine: [Verein], export_filename: str):
|
|
export_string: str = TABLE_HEADING + '\n'
|
|
for verein in vereine:
|
|
export_string += line_for_verein(verein) + '\n'
|
|
|
|
with open(export_filename, 'w') as export_file:
|
|
export_file.writelines(export_string)
|
|
|
|
|
|
def line_for_verein(verein: Verein):
|
|
return f'"{verein.account_name}","{verein.address}",{verein.post_code},"{verein.city}",' \
|
|
f'{verein.total_balance},{verein.available_balance},{verein.redeemed}'
|