recipe links

This commit is contained in:
Joren de Graaf
2026-10-23 14:30:58 +02:00
parent 5b986134be
commit 4d76a2bc9c
52 changed files with 2698 additions and 19 deletions
@@ -0,0 +1,35 @@
# Generated by Django 6.1.1 on 2026-10-23 11:53
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0006_cooklater'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='RecipeLink',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('relationship', models.CharField(choices=[('goes_well_with', 'Goes well with'), ('try_with', 'Try with'), ('alternative_to', 'Alternative to')], default='goes_well_with', max_length=24)),
('note', models.CharField(blank=True, max_length=255)),
('reciprocal', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='recipe_links', to=settings.AUTH_USER_MODEL)),
('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outgoing_links', to='recipes.recipe')),
('target', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incoming_links', to='recipes.recipe')),
],
options={
'ordering': ('created_at', 'id'),
'constraints': [models.UniqueConstraint(fields=('owner', 'source', 'target'), name='recipes_unique_link_direction'), models.CheckConstraint(condition=models.Q(('source', models.F('target')), _negated=True), name='recipes_link_not_self')],
},
),
]