diff --git a/TimeBank_account/migrations/0003_auto_20210518_1607.py b/TimeBank_account/migrations/0003_auto_20210518_1607.py new file mode 100644 index 0000000..a6e2f50 --- /dev/null +++ b/TimeBank_account/migrations/0003_auto_20210518_1607.py @@ -0,0 +1,20 @@ +# Generated by Django 3.1.7 on 2021-05-18 16:07 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('TimeBank_account', '0002_auto_20210518_1544'), + ] + + operations = [ + migrations.AlterField( + model_name='account', + name='user', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/TimeBank_account/models.py b/TimeBank_account/models.py index 24f0591..a580909 100644 --- a/TimeBank_account/models.py +++ b/TimeBank_account/models.py @@ -65,7 +65,7 @@ class Meta: # 계좌 모델 class Account(models.Model): account_no = models.CharField(max_length=20, verbose_name='계좌번호') - user = models.ForeignKey(User, unique=True, on_delete=models.CASCADE) + user = models.OneToOneField(User, on_delete=models.CASCADE) balance = models.IntegerField(default=0, verbose_name='잔액') @classmethod