From 46769a5b379be61eace048b8da48170d99a57b14 Mon Sep 17 00:00:00 2001 From: Rosalina Date: Sun, 14 Jul 2024 18:17:06 -0400 Subject: [PATCH] blehhhhh --- .../0007_alter_sharedthread_uuid.py | 19 +++++++++++++++++++ assistant/models.py | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 assistant/migrations/0007_alter_sharedthread_uuid.py diff --git a/assistant/migrations/0007_alter_sharedthread_uuid.py b/assistant/migrations/0007_alter_sharedthread_uuid.py new file mode 100644 index 00000000..ecdd57e7 --- /dev/null +++ b/assistant/migrations/0007_alter_sharedthread_uuid.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.7 on 2024-07-14 22:16 + +import uuid +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assistant', '0006_sharedthread'), + ] + + operations = [ + migrations.AlterField( + model_name='sharedthread', + name='uuid', + field=models.UUIDField(db_index=True, default=uuid.uuid4, editable=False), + ), + ] diff --git a/assistant/models.py b/assistant/models.py index 7663ad41..3d2f021a 100644 --- a/assistant/models.py +++ b/assistant/models.py @@ -33,7 +33,10 @@ def get_absolute_url(self): class SharedThread(models.Model): - uuid = models.UUIDField(default=uuid.uuid4, editable=False) + uuid = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True) creator = models.ForeignKey('users.User', on_delete=models.CASCADE) thread = models.ForeignKey(Thread, on_delete=models.CASCADE) data = models.JSONField() + + def get_absolute_url(self): + return reverse('assistant:view_shared_thread', args=[str(self.uuid)])