CSV取込機能を実装し、Expenseモデルと関連するStore・ExpenseCategoryモデルを追加。CSVパーサーを作成し、出光CSVに対応。明細編集画面のAJAX保存機能を実装し、取込結果を表示する機能を追加。作業ログをdiary.mdに追記。

This commit is contained in:
president
2025-12-19 15:51:14 +09:00
parent 5fc2a31f50
commit 89caf3438a
11 changed files with 489 additions and 7 deletions

View File

@@ -0,0 +1,54 @@
# Generated by Django 4.2.27 on 2025-12-19 06:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ExpenseCategory',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, unique=True)),
('is_active', models.BooleanField(default=True)),
],
),
migrations.CreateModel(
name='Store',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, unique=True)),
('is_active', models.BooleanField(default=True)),
],
),
migrations.CreateModel(
name='Expense',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('use_date', models.DateField()),
('description', models.CharField(max_length=255)),
('amount', models.IntegerField()),
('is_business', models.BooleanField(blank=True, null=True)),
('note', models.TextField(blank=True)),
('source', models.CharField(choices=[('idemitsu', 'Idemitsu')], max_length=50)),
('source_hash', models.CharField(max_length=64)),
('ai_score', models.FloatField(blank=True, null=True)),
('human_confirmed', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('expense_category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='expenses.expensecategory')),
('store', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='expenses.store')),
],
),
migrations.AddConstraint(
model_name='expense',
constraint=models.UniqueConstraint(fields=('source', 'source_hash'), name='uniq_source_hash'),
),
]