mirror of https://gitlab.crans.org/bde/nk20
Réagencement des tables et de leurs attributs
This commit is contained in:
parent
a481adbae4
commit
968fa64d37
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 2.2.28 on 2024-05-17 18:44
|
||||
# Generated by Django 2.2.28 on 2024-05-21 12:05
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -14,6 +14,58 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Basic_food',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='name')),
|
||||
('is_DLC', models.BooleanField(default=False, verbose_name='is DLC')),
|
||||
('is_DDM', models.BooleanField(default=False, verbose_name='is DDM')),
|
||||
('expiry_date', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='expiry date')),
|
||||
('label', models.ImageField(default='pic/default.png', max_length=255, upload_to='label/', verbose_name='food label')),
|
||||
('was_eaten', models.BooleanField(default=False, verbose_name='was eaten')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='owner')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Basic food',
|
||||
'verbose_name_plural': 'Basic foods',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Transformed_food',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='name')),
|
||||
('creation_date', models.DateTimeField(verbose_name='creation date')),
|
||||
('expiry_date', models.DateTimeField(verbose_name='expiry date')),
|
||||
('is_active', models.BooleanField(default=True, verbose_name='is active')),
|
||||
('was_eaten', models.BooleanField(default=False, verbose_name='was eaten')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='owner')),
|
||||
('transformed_ingredient', models.ManyToManyField(blank=True, related_name='transformed_ingredient_inv', to='food.Transformed_food', verbose_name='transformed ingredient')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Transformed food',
|
||||
'verbose_name_plural': 'Transformed foods',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='QR_code',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('qr_code_number', models.PositiveIntegerField(verbose_name='QR-code number')),
|
||||
('basic_food', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='QR_code', to='food.Basic_food', verbose_name='basic food')),
|
||||
('transformed_food_container', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='QR_code', to='food.Transformed_food', verbose_name='transformed food container')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'QR-code',
|
||||
'verbose_name_plural': 'QR-codes',
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='basic_food',
|
||||
name='transformed_food',
|
||||
field=models.ManyToManyField(blank=True, related_name='Basic_food', to='food.Transformed_food', verbose_name='transformed food'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Allergen',
|
||||
fields=[
|
||||
|
@ -33,64 +85,12 @@ class Migration(migrations.Migration):
|
|||
('groundnut', models.BooleanField(default=False, verbose_name='groundnut')),
|
||||
('sesame', models.BooleanField(default=False, verbose_name='sesame')),
|
||||
('alcohol', models.BooleanField(default=False, verbose_name='alcohol')),
|
||||
('basic_food', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='Allergen', to='food.Basic_food', verbose_name='basic food')),
|
||||
('transformed_food', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='Allergen', to='food.Transformed_food', verbose_name='transformed food')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Allergen',
|
||||
'verbose_name_plural': 'Allergens',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Basic_food',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='name')),
|
||||
('is_DLC', models.BooleanField(default=False, verbose_name='is DLC')),
|
||||
('is_DDM', models.BooleanField(default=False, verbose_name='is DDM')),
|
||||
('expiry_date', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='expiry date')),
|
||||
('label', models.ImageField(default='pic/default.png', max_length=255, upload_to='label/', verbose_name='food label')),
|
||||
('was_eaten', models.BooleanField(default=False, verbose_name='was eaten')),
|
||||
('allergen', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='food.Allergen', verbose_name='allergen')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='owner')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Basic food',
|
||||
'verbose_name_plural': 'Basic foods',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='QR_code',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('qr_code_number', models.PositiveIntegerField(verbose_name='QR-code number')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'QR-code',
|
||||
'verbose_name_plural': 'QR-codes',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Transformed_food',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='name')),
|
||||
('creation_date', models.DateTimeField(verbose_name='creation date')),
|
||||
('expiry_date', models.DateTimeField(verbose_name='expiry date')),
|
||||
('is_active', models.BooleanField(default=True, verbose_name='is active')),
|
||||
('was_eaten', models.BooleanField(default=False, verbose_name='was eaten')),
|
||||
('allergen', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='food.Allergen', verbose_name='allergen')),
|
||||
('basic_ingredient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Basic_food', verbose_name='basic ingredient')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='member.Club', verbose_name='owner')),
|
||||
('qr_code', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.QR_code', verbose_name='QR code')),
|
||||
('transformed_ingredient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Transformed_food', verbose_name='transformed ingredient')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Transformed food',
|
||||
'verbose_name_plural': 'Transformed foods',
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='basic_food',
|
||||
name='qr_code',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='food.QR_code', verbose_name='QR code'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 2.2.28 on 2024-05-21 09:03
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('food', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='transformed_food',
|
||||
name='transformed_ingredient',
|
||||
field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Transformed_food', verbose_name='transformed ingredient'),
|
||||
),
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 2.2.28 on 2024-05-21 09:10
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('food', '0002_auto_20240521_1103'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='transformed_food',
|
||||
name='transformed_ingredient',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='food.Transformed_food', verbose_name='transformed ingredient'),
|
||||
),
|
||||
]
|
|
@ -19,7 +19,25 @@ class QR_code(models.Model):
|
|||
An QR_code model
|
||||
"""
|
||||
qr_code_number = models.PositiveIntegerField(
|
||||
verbose_name=_("QR-code number"),
|
||||
verbose_name=_("QR-code number"),
|
||||
)
|
||||
|
||||
transformed_food_container = models.ForeignKey(
|
||||
'Transformed_food',
|
||||
on_delete = models.PROTECT,
|
||||
related_name = 'QR_code',
|
||||
null = True,
|
||||
blank = True,
|
||||
verbose_name = _('transformed food container'),
|
||||
)
|
||||
|
||||
basic_food = models.ForeignKey(
|
||||
'Basic_food',
|
||||
on_delete = models.PROTECT,
|
||||
related_name = 'QR_code',
|
||||
null = True,
|
||||
blank = True,
|
||||
verbose_name = _('basic food'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@ -109,6 +127,24 @@ class Allergen(models.Model):
|
|||
verbose_name = _('alcohol'),
|
||||
)
|
||||
|
||||
transformed_food = models.ForeignKey(
|
||||
'Transformed_food',
|
||||
on_delete = models.CASCADE,
|
||||
related_name = 'Allergen',
|
||||
blank = True,
|
||||
null = True,
|
||||
verbose_name = _('transformed food'),
|
||||
)
|
||||
|
||||
basic_food = models.ForeignKey(
|
||||
'Basic_food',
|
||||
on_delete = models.CASCADE,
|
||||
related_name = 'Allergen',
|
||||
blank = True,
|
||||
null = True,
|
||||
verbose_name = _('basic food'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Allergen')
|
||||
verbose_name_plural = _('Allergens')
|
||||
|
@ -158,25 +194,19 @@ class Basic_food(models.Model):
|
|||
default= 'pic/default.png',
|
||||
)
|
||||
|
||||
qr_code = models.ForeignKey(
|
||||
QR_code,
|
||||
on_delete=models.PROTECT,
|
||||
related_name= '+',
|
||||
verbose_name=_('QR code'),
|
||||
)
|
||||
|
||||
was_eaten = models.BooleanField(
|
||||
verbose_name=_('was eaten'),
|
||||
default = False,
|
||||
)
|
||||
|
||||
allergen = models.ForeignKey(
|
||||
Allergen,
|
||||
on_delete = models.PROTECT,
|
||||
related_name = '+',
|
||||
verbose_name = _('allergen'),
|
||||
transformed_food = models.ManyToManyField(
|
||||
'Transformed_food',
|
||||
related_name= 'Basic_food',
|
||||
blank = True,
|
||||
verbose_name = _('transformed food'),
|
||||
)
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name=_('Basic food')
|
||||
verbose_name_plural=_('Basic foods')
|
||||
|
@ -208,46 +238,24 @@ class Transformed_food(models.Model):
|
|||
verbose_name =_('owner'),
|
||||
)
|
||||
|
||||
transformed_ingredient = models.ForeignKey(
|
||||
transformed_ingredient = models.ManyToManyField(
|
||||
"self",
|
||||
on_delete = models.CASCADE,
|
||||
blank = True,
|
||||
null = True,
|
||||
related_name = '+',
|
||||
symmetrical = False,
|
||||
related_name = 'transformed_ingredient_inv',
|
||||
verbose_name = _('transformed ingredient'),
|
||||
)
|
||||
|
||||
basic_ingredient = models.ForeignKey(
|
||||
Basic_food,
|
||||
on_delete = models.CASCADE,
|
||||
related_name = '+',
|
||||
verbose_name = _('basic ingredient'),
|
||||
)
|
||||
|
||||
|
||||
is_active = models.BooleanField(
|
||||
default = True,
|
||||
verbose_name = _('is active'),
|
||||
)
|
||||
|
||||
qr_code = models.ForeignKey(
|
||||
QR_code,
|
||||
on_delete = models.CASCADE,
|
||||
related_name = '+',
|
||||
verbose_name = _('QR code'),
|
||||
)
|
||||
|
||||
was_eaten = models.BooleanField(
|
||||
default = False,
|
||||
verbose_name = _('was eaten'),
|
||||
)
|
||||
|
||||
allergen = models.ForeignKey(
|
||||
Allergen,
|
||||
on_delete = models.PROTECT,
|
||||
related_name= '+',
|
||||
verbose_name = _('allergen'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Transformed food')
|
||||
|
|
Loading…
Reference in New Issue