Skip to content

Commit

Permalink
🗃️ [#26] Added user to the Customer model
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhanCitil committed Feb 16, 2024
1 parent efe832f commit 9b70444
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/bobvance/base/migrations/0006_customer_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.21 on 2023-10-12 08:23

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('base', '0005_order_total_price'),
]

operations = [
migrations.AddField(
model_name='customer',
name='user',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
2 changes: 2 additions & 0 deletions src/bobvance/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

from bobvance.base.choices import OrderStatusChoices

from bobvance.accounts.models import User

# Create your models here.
class Customer(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True)
firstname = models.CharField(max_length=50)
lastname = models.CharField(max_length=50)
email = models.EmailField()
Expand Down

0 comments on commit 9b70444

Please sign in to comment.