diff --git a/vrobbler/apps/foods/migrations/0003_food_calories.py b/vrobbler/apps/foods/migrations/0003_food_calories.py new file mode 100644 index 0000000..bf93c2a --- /dev/null +++ b/vrobbler/apps/foods/migrations/0003_food_calories.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.19 on 2025-09-11 13:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('foods', '0002_alter_food_run_time_seconds'), + ] + + operations = [ + migrations.AddField( + model_name='food', + name='calories', + field=models.IntegerField(blank=True, null=True), + ), + ] diff --git a/vrobbler/apps/foods/models.py b/vrobbler/apps/foods/models.py index 54a5e24..5cb93a5 100644 --- a/vrobbler/apps/foods/models.py +++ b/vrobbler/apps/foods/models.py @@ -48,6 +48,7 @@ class FoodCategory(TimeStampedModel): class Food(ScrobblableMixin): description = models.TextField(**BNULL) + calories = models.IntegerField(**BNULL) allrecipe_image = models.ImageField(upload_to="food/recipe/", **BNULL) allrecipe_image_small = ImageSpecField( source="allrecipe_image", @@ -72,7 +73,8 @@ class Food(ScrobblableMixin): @property def subtitle(self): - return self.category.name + if self.category: + return self.category.name @property def strings(self) -> ScrobblableConstants: