generated from 2martens/django-template
Added calories to profile and converted nutritional data to decimal fields
This commit is contained in:
73
food_planner/migrations/0005_auto_20200223_1317.py
Normal file
73
food_planner/migrations/0005_auto_20200223_1317.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-02-23 12:17
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('food_planner', '0004_recipe_calories'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_calories_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=2000.0, help_text='At most this amount of kilo calories is needed per day', max_digits=6, verbose_name='Daily kilo calories demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_carbohydrate_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=150.0, help_text='At most this amount of carbohydrates is needed per day', max_digits=5, verbose_name='Daily carbohydrate demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_fat_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=117.0, help_text='At most this amount of fat is needed per day', max_digits=5, verbose_name='Daily fat demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_protein_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=90.0, help_text='At most this amount of protein should be eaten per day', max_digits=5, verbose_name='Daily protein demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_roughage_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=30.0, help_text='At least this amount of roughage should be eaten per day', max_digits=5, verbose_name='Daily roughage demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='daily_sugar_demand',
|
||||||
|
field=models.DecimalField(decimal_places=2, default=25.0, help_text='At most this amount of sugar is needed per day', max_digits=5, verbose_name='Daily sugar demand'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='calories',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How many kilo calories are contained in one portion?', max_digits=6, verbose_name='Kilo Calories'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='carbohydrates',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How much carbohydrates does one portion contain?', max_digits=5, verbose_name='Carbohydrates'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='fat',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How much fat does one portion contain?', max_digits=5, verbose_name='Fat'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='protein',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How much protein does one portion contain?', max_digits=5, verbose_name='Protein'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='roughage',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How much roughage does one portion contain?', max_digits=5, verbose_name='Roughage'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recipe',
|
||||||
|
name='sugar',
|
||||||
|
field=models.DecimalField(decimal_places=2, help_text='How much sugar does one portion contain?', max_digits=5, verbose_name='Sugar'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -17,24 +17,42 @@ MEASUREMENT_UNITS = [('KG', 'kg'),
|
|||||||
|
|
||||||
class Profile(models.Model):
|
class Profile(models.Model):
|
||||||
user = models.OneToOneField(User, models.CASCADE)
|
user = models.OneToOneField(User, models.CASCADE)
|
||||||
daily_fat_demand = models.PositiveIntegerField(_('Daily fat demand'),
|
daily_calories_demand = models.DecimalField(_('Daily kilo calories demand'),
|
||||||
help_text=_('At most this amount of fat is needed per day'),
|
help_text=_('At most this amount of kilo calories is needed per day'),
|
||||||
default=117)
|
default=2000.00,
|
||||||
daily_carbohydrate_demand = models.PositiveIntegerField(
|
decimal_places=2,
|
||||||
|
max_digits=6)
|
||||||
|
daily_fat_demand = models.DecimalField(_('Daily fat demand'),
|
||||||
|
help_text=_('At most this amount of fat is needed per day'),
|
||||||
|
default=117.00,
|
||||||
|
decimal_places=2,
|
||||||
|
max_digits=5)
|
||||||
|
daily_carbohydrate_demand = models.DecimalField(
|
||||||
_('Daily carbohydrate demand'),
|
_('Daily carbohydrate demand'),
|
||||||
help_text=_('At most this amount of carbohydrates is needed per day'),
|
help_text=_('At most this amount of carbohydrates is needed per day'),
|
||||||
default=150)
|
default=150.00,
|
||||||
daily_sugar_demand = models.PositiveIntegerField(_('Daily sugar demand'),
|
decimal_places=2,
|
||||||
help_text=_('At most this amount of sugar is needed per day'),
|
max_digits=5,
|
||||||
default=25)
|
)
|
||||||
daily_roughage_demand = models.PositiveIntegerField(
|
daily_sugar_demand = models.DecimalField(_('Daily sugar demand'),
|
||||||
|
help_text=_('At most this amount of sugar is needed per day'),
|
||||||
|
default=25.00,
|
||||||
|
decimal_places=2,
|
||||||
|
max_digits=5)
|
||||||
|
daily_roughage_demand = models.DecimalField(
|
||||||
_('Daily roughage demand'),
|
_('Daily roughage demand'),
|
||||||
help_text=_('At least this amount of roughage should be eaten per day'),
|
help_text=_('At least this amount of roughage should be eaten per day'),
|
||||||
default=30)
|
default=30.00,
|
||||||
daily_protein_demand = models.PositiveIntegerField(
|
decimal_places=2,
|
||||||
|
max_digits=5
|
||||||
|
)
|
||||||
|
daily_protein_demand = models.DecimalField(
|
||||||
_('Daily protein demand'),
|
_('Daily protein demand'),
|
||||||
help_text=_('At most this amount of protein should be eaten per day'),
|
help_text=_('At most this amount of protein should be eaten per day'),
|
||||||
default=90)
|
default=90.00,
|
||||||
|
decimal_places=2,
|
||||||
|
max_digits=5,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Profile')
|
verbose_name = _('Profile')
|
||||||
@ -82,18 +100,18 @@ class Recipe(models.Model):
|
|||||||
('EXP', _('Expert'))
|
('EXP', _('Expert'))
|
||||||
])
|
])
|
||||||
|
|
||||||
calories = models.PositiveIntegerField(_('Calories'),
|
calories = models.DecimalField(_('Kilo Calories'), decimal_places=2, max_digits=6,
|
||||||
help_text=_('How many calories are contained in one portion?'))
|
help_text=_('How many kilo calories are contained in one portion?'))
|
||||||
fat = models.PositiveIntegerField(_('Fat'),
|
fat = models.DecimalField(_('Fat'), decimal_places=2, max_digits=5,
|
||||||
help_text=_('How much fat does one portion contain?'))
|
help_text=_('How much fat does one portion contain?'))
|
||||||
carbohydrates = models.PositiveIntegerField(_('Carbohydrates'),
|
carbohydrates = models.DecimalField(_('Carbohydrates'), decimal_places=2, max_digits=5,
|
||||||
help_text=_('How much carbohydrates does one portion contain?'))
|
help_text=_('How much carbohydrates does one portion contain?'))
|
||||||
sugar = models.PositiveIntegerField(_('Sugar'),
|
sugar = models.DecimalField(_('Sugar'), decimal_places=2, max_digits=5,
|
||||||
help_text=_('How much sugar does one portion contain?'))
|
help_text=_('How much sugar does one portion contain?'))
|
||||||
roughage = models.PositiveIntegerField(_('Roughage'),
|
roughage = models.DecimalField(_('Roughage'), decimal_places=2, max_digits=5,
|
||||||
help_text=_('How much roughage does one portion contain?'))
|
help_text=_('How much roughage does one portion contain?'))
|
||||||
protein = models.PositiveIntegerField(_('Protein'),
|
protein = models.DecimalField(_('Protein'), decimal_places=2, max_digits=5,
|
||||||
help_text=_('How much protein does one portion contain?'))
|
help_text=_('How much protein does one portion contain?'))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Recipe')
|
verbose_name = _('Recipe')
|
||||||
|
|||||||
Reference in New Issue
Block a user