Added name to meal plan

This commit is contained in:
2020-02-23 14:23:26 +01:00
parent 78d5ffc8f3
commit 352c0c89f4
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.3 on 2020-02-23 13:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('food_planner', '0006_auto_20200223_1331'),
]
operations = [
migrations.AddField(
model_name='mealplan',
name='name',
field=models.CharField(default='', max_length=255, verbose_name='Name'),
preserve_default=False,
),
]

View File

@ -221,6 +221,7 @@ class StoredIngredient(models.Model):
class MealPlan(models.Model): class MealPlan(models.Model):
author = models.ForeignKey(User, models.SET_NULL, null=True) author = models.ForeignKey(User, models.SET_NULL, null=True)
name = models.CharField(_('Name'), max_length=255)
monday_breakfast = models.ForeignKey(Recipe, models.SET_NULL, blank=True, null=True, monday_breakfast = models.ForeignKey(Recipe, models.SET_NULL, blank=True, null=True,
related_name='monday_breakfast') related_name='monday_breakfast')
@ -299,6 +300,9 @@ class MealPlan(models.Model):
sunday_dinner = models.ForeignKey(Recipe, models.SET_NULL, blank=True, null=True, sunday_dinner = models.ForeignKey(Recipe, models.SET_NULL, blank=True, null=True,
related_name='sunday_dinner') related_name='sunday_dinner')
def __str__(self):
return self.name
class Meta: class Meta:
verbose_name = _('Meal plan') verbose_name = _('Meal plan')
verbose_name_plural = _('Meal plans') verbose_name_plural = _('Meal plans')