generated from 2martens/django-template
Added name to meal plan
This commit is contained in:
19
food_planner/migrations/0007_mealplan_name.py
Normal file
19
food_planner/migrations/0007_mealplan_name.py
Normal 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,
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -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')
|
||||||
|
|||||||
Reference in New Issue
Block a user