--- /dev/null
+# Generated by Django 5.1.2 on 2024-10-28 01:55
+
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("documents", "1055_alter_storagepath_path"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="customfieldinstance",
+ name="deleted_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="customfieldinstance",
+ name="restored_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="customfieldinstance",
+ name="transaction_id",
+ field=models.UUIDField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="note",
+ name="deleted_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="note",
+ name="restored_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="note",
+ name="transaction_id",
+ field=models.UUIDField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="sharelink",
+ name="deleted_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="sharelink",
+ name="restored_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="sharelink",
+ name="transaction_id",
+ field=models.UUIDField(blank=True, null=True),
+ ),
+ ]
return f"Task {self.task_id}"
-class Note(models.Model):
+class Note(SoftDeleteModel):
note = models.TextField(
_("content"),
blank=True,
return self.note
-class ShareLink(models.Model):
+class ShareLink(SoftDeleteModel):
class FileVersion(models.TextChoices):
ARCHIVE = ("archive", _("Archive"))
ORIGINAL = ("original", _("Original"))
return f"{self.name} : {self.data_type}"
-class CustomFieldInstance(models.Model):
+class CustomFieldInstance(SoftDeleteModel):
"""
A single instance of a field, attached to a CustomField for the name and type
and attached to a single Document to be metadata for it
super().update(instance, validated_data)
else:
super().update(instance, validated_data)
+ # hard delete custom field instances that were soft deleted
+ CustomFieldInstance.deleted_objects.filter(document=instance).delete()
return instance
def __init__(self, *args, **kwargs):