From e1ffd348d40a07e23afab2e461726eb635ff1cdd Mon Sep 17 00:00:00 2001 From: Laurent Date: Sun, 20 Jul 2025 12:08:59 +0200 Subject: [PATCH] change ids to uuid + fix --- ...options_alter_prospect_options_and_more.py | 52 +++++++++++++++++++ bizdev/models.py | 9 ++++ 2 files changed, 61 insertions(+) create mode 100644 bizdev/migrations/0003_alter_activity_options_alter_prospect_options_and_more.py diff --git a/bizdev/migrations/0003_alter_activity_options_alter_prospect_options_and_more.py b/bizdev/migrations/0003_alter_activity_options_alter_prospect_options_and_more.py new file mode 100644 index 0000000..207a70a --- /dev/null +++ b/bizdev/migrations/0003_alter_activity_options_alter_prospect_options_and_more.py @@ -0,0 +1,52 @@ +# Generated by Django 5.1 on 2025-07-20 10:08 + +import uuid +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bizdev', '0002_activity_declination_reason_alter_activity_status'), + ] + + operations = [ + migrations.AlterModelOptions( + name='activity', + options={'ordering': ['-creation_date'], 'verbose_name_plural': 'Activities'}, + ), + migrations.AlterModelOptions( + name='prospect', + options={}, + ), + migrations.AlterField( + model_name='activity', + name='id', + field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='activity', + name='status', + field=models.CharField(blank=True, choices=[('NONE', 'None'), ('INBOUND', 'Inbound'), ('CONTACTED', 'Contacted'), ('RESPONDED', 'Responded'), ('SHOULD_TEST', 'Should test'), ('TESTING', 'Testing'), ('CUSTOMER', 'Customer'), ('LOST', 'Lost customer'), ('DECLINED', 'Declined'), ('DECLINED_UNRELATED', 'Declined without significance')], max_length=50, null=True), + ), + migrations.AlterField( + model_name='activity', + name='type', + field=models.CharField(blank=True, choices=[('MAIL', 'Mail'), ('SMS', 'SMS'), ('CALL', 'Call'), ('PRESS', 'Press Release'), ('WORD_OF_MOUTH', 'Word of mouth')], max_length=20, null=True), + ), + migrations.AlterField( + model_name='emailtemplate', + name='id', + field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='entity', + name='id', + field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='prospect', + name='id', + field=models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False), + ), + ] diff --git a/bizdev/models.py b/bizdev/models.py index 5f4b93d..86b3ced 100644 --- a/bizdev/models.py +++ b/bizdev/models.py @@ -6,6 +6,8 @@ from django.db.models.signals import m2m_changed from django.dispatch import receiver from django.utils import timezone +import uuid + from sync.models import BaseModel User = get_user_model() @@ -36,6 +38,7 @@ class ActivityType(models.TextChoices): WORD_OF_MOUTH = 'WORD_OF_MOUTH', 'Word of mouth' class Entity(BaseModel): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) name = models.CharField(max_length=200, null=True, blank=True) address = models.CharField(max_length=200, null=True, blank=True) zip_code = models.CharField(max_length=20, null=True, blank=True) @@ -53,6 +56,7 @@ class Entity(BaseModel): return self.name class Prospect(BaseModel): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) first_name = models.CharField(max_length=200, null=True, blank=True) last_name = models.CharField(max_length=200, null=True, blank=True) email = models.EmailField(unique=True) @@ -95,6 +99,7 @@ class Prospect(BaseModel): return self.full_name() class Activity(BaseModel): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) status = models.CharField(max_length=50, choices=Status.choices, null=True, blank=True) declination_reason = models.CharField(max_length=50, choices=DeclinationReason.choices, null=True, blank=True) type = models.CharField(max_length=20, choices=ActivityType.choices, null=True, blank=True) @@ -137,6 +142,7 @@ def update_prospect_last_update(sender, instance, action, pk_set, **kwargs): instance.prospects.update(last_update=timezone.now()) class EmailTemplate(BaseModel): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) name = models.CharField(max_length=100) subject = models.CharField(max_length=200) body = models.TextField(null=True, blank=True) @@ -145,6 +151,9 @@ class EmailTemplate(BaseModel): 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)