basic accoutn delteion fixed

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-06 16:06:56 +00:00
parent 365dcfbbd2
commit a0eee0df42
4 changed files with 41 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('igny8_core_auth', '0004_add_invoice_payment_models'),
]
operations = [
migrations.AlterField(
model_name='account',
name='owner',
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name='owned_accounts',
to='igny8_core_auth.user',
),
),
]

View File

@@ -65,7 +65,13 @@ class Account(models.Model):
name = models.CharField(max_length=255)
slug = models.SlugField(unique=True, max_length=255)
owner = models.ForeignKey('igny8_core_auth.User', on_delete=models.PROTECT, related_name='owned_accounts')
owner = models.ForeignKey(
'igny8_core_auth.User',
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='owned_accounts',
)
stripe_customer_id = models.CharField(max_length=255, blank=True, null=True)
plan = models.ForeignKey('igny8_core_auth.Plan', on_delete=models.PROTECT, related_name='accounts')
credits = models.IntegerField(default=0, validators=[MinValueValidator(0)])