From 405b18a0e0b94ef22a5f62b4c311a9f84d4d9495 Mon Sep 17 00:00:00 2001 From: dansubak Date: Tue, 15 Sep 2026 15:02:58 -0400 Subject: [PATCH 1/2] Add migration to add data consent boolean, timestamps --- ...2bcontract_consent_modified_at_and_more.py | 36 +++++++++++++++++++ b2b/models.py | 4 ++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py diff --git a/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py b/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py new file mode 100644 index 0000000000..a632d52313 --- /dev/null +++ b/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 5.2.15 on 2026-09-15 19:02 + +import django.utils.timezone +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("b2b", "0029_userb2bcontract"), + ] + + operations = [ + migrations.AddField( + model_name="userb2bcontract", + name="consent_modified_at", + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AddField( + model_name="userb2bcontract", + name="consented_to_data_sharing", + field=models.BooleanField(null=True), + ), + migrations.AddField( + model_name="userb2bcontract", + name="created_on", + field=models.DateTimeField( + auto_now_add=True, default=django.utils.timezone.now + ), + preserve_default=False, + ), + migrations.AddField( + model_name="userb2bcontract", + name="updated_on", + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/b2b/models.py b/b2b/models.py index 592bb4229e..4263d50fd1 100644 --- a/b2b/models.py +++ b/b2b/models.py @@ -995,7 +995,7 @@ def is_organization_manager(user, org_id): ).exists() -class UserB2BContract(models.Model): +class UserB2BContract(TimestampedModel): user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, @@ -1006,6 +1006,8 @@ class UserB2BContract(models.Model): on_delete=models.CASCADE, related_name="b2b_contract_users", ) + consented_to_data_sharing = models.BooleanField(null=True) + consent_modified_at = models.DateTimeField(null=True, blank=True) class Meta: unique_together = ("user", "contract_page") From 07720487b70f17b7d9b4ac392edfea18c05ab1de Mon Sep 17 00:00:00 2001 From: Dan Subak Date: Tue, 22 Sep 2026 12:53:04 -0400 Subject: [PATCH 2/2] PR feedback --- .../0030_userb2bcontract_consent_modified_at_and_more.py | 1 + 1 file changed, 1 insertion(+) diff --git a/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py b/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py index a632d52313..5855048991 100644 --- a/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py +++ b/b2b/migrations/0030_userb2bcontract_consent_modified_at_and_more.py @@ -7,6 +7,7 @@ class Migration(migrations.Migration): dependencies = [ ("b2b", "0029_userb2bcontract"), + ("users", "0044_alter_user_b2b_contracts"), ] operations = [