# Django-BillManager **Repository Path**: pywjh/Django-BillManager ## Basic Information - **Project Name**: Django-BillManager - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-14 - **Last Updated**: 2021-10-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Django-BillManager 之前用Flask做了一个类似的,数据支持用的是csv文件,现在用Django做一个,数据库用的sqlite,方便使用 #####csv文件转数据库脚本 ```python import csv from index.models import BillModel, DayDetailModel bill_7 = BillModel.objects.get(date='2020-7-15') bill_7 # path = '/Users/wjh/Documents/project/ShangHaiBillManage/cost_record/2020/2020_7.csv' with open(path, encoding='GBK') as f: datas = [i for i in csv.DictReader(f) if i] for i in datas: i['date'] = f"2020-{i['date'].replace('_', '-')}" for i in datas: d = DayDetailModel() d.date = i['date'] d.name = i['name'] d.amount = float(i['payment']) d.type = i['type'] d.note = i.get('note', '') d.bill_id = bill_7 d.save() ```