From d4de2ae399bb2db959c646ca0884c1c555f577b7 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 22 Sep 2025 16:02:08 +0200 Subject: [PATCH] replace int id by uuid id + bonus --- biz/migrations/0006_alter_campaign_id.py | 19 +++++++++++++++++++ biz/models.py | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100644 biz/migrations/0006_alter_campaign_id.py diff --git a/biz/migrations/0006_alter_campaign_id.py b/biz/migrations/0006_alter_campaign_id.py new file mode 100644 index 0000000..9f829d8 --- /dev/null +++ b/biz/migrations/0006_alter_campaign_id.py @@ -0,0 +1,19 @@ +# Generated by Django 5.1 on 2025-09-22 13:10 + +import uuid +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('biz', '0005_alter_activity_status_campaign'), + ] + + operations = [ + migrations.AlterField( + model_name='campaign', + name='id', + field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False), + ), + ] diff --git a/biz/models.py b/biz/models.py index 69401a6..e271b18 100644 --- a/biz/models.py +++ b/biz/models.py @@ -172,12 +172,19 @@ class EmailTemplate(BaseModel): pass class Campaign(BaseModel): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) name = models.CharField(max_length=200, null=True, blank=True) prospects = models.ManyToManyField(Prospect, blank=True, related_name='campaigns') def user_count(self): return self.prospects.count() + def __str__(self): + return self.name + + def delete_dependencies(self): + pass + # class EmailCampaign(models.Model): # event = models.OneToOneField(Event, on_delete=models.CASCADE) # subject = models.CharField(max_length=200)