Adjust migrations

This commit is contained in:
Oliver Walters
2026-06-13 11:37:06 +00:00
parent cf43ff37a9
commit e31a242238
2 changed files with 20 additions and 9 deletions
@@ -47,11 +47,15 @@ class Migration(migrations.Migration):
verbose_name="Updated", verbose_name="Updated",
), ),
), ),
("model_id", models.PositiveIntegerField()), ("model_id", models.PositiveIntegerField(
blank=True,
null=True,
help_text="Target model instance ID for this note",
)),
( (
"title", "title",
models.CharField( models.CharField(
help_text="Note title", max_length=100, verbose_name="Title" help_text="Note title", max_length=100, verbose_name="Title",
), ),
), ),
( (
@@ -74,6 +78,17 @@ class Migration(migrations.Migration):
models.ForeignKey( models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, on_delete=django.db.models.deletion.CASCADE,
to="contenttypes.contenttype", to="contenttypes.contenttype",
help_text="Target model type for this note",
blank=True,
null=True,
),
),
(
"template",
models.BooleanField(
default=False,
help_text="Is this note a template (not linked to a specific model instance)?",
verbose_name="Template",
), ),
), ),
( (
@@ -125,7 +140,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint( migrations.AddConstraint(
model_name="note", model_name="note",
constraint=models.UniqueConstraint( constraint=models.UniqueConstraint(
condition=models.Q(("primary", True)), condition=models.Q(("primary", True), ("template", False)),
fields=("model_type", "model_id"), fields=("model_type", "model_id"),
name="unique_primary_note_per_model", name="unique_primary_note_per_model",
), ),
+2 -6
View File
@@ -3178,15 +3178,11 @@ class Note(
on_delete=models.CASCADE, on_delete=models.CASCADE,
null=True, null=True,
blank=True, blank=True,
help_text=_( help_text=_('Target model type for this note'),
'Target model type for this note (null = applies to all model types)'
),
) )
model_id = models.PositiveIntegerField( model_id = models.PositiveIntegerField(
null=True, null=True, blank=True, help_text=_('Target model instance ID for this note')
blank=True,
help_text=_('Target model instance ID for this note (null for templates)'),
) )
content_object = GenericForeignKey('model_type', 'model_id') content_object = GenericForeignKey('model_type', 'model_id')