generated from 2martens/django-template
Added translated verbose names of models
This commit is contained in:
@ -37,6 +37,10 @@ class Profile(models.Model):
|
||||
help_text=_('At most this amount of protein should be eaten per day'),
|
||||
default=90)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Profile')
|
||||
verbose_name_plural = _('Profiles')
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
@ -44,6 +48,10 @@ class Profile(models.Model):
|
||||
class KitchenUtility(models.Model):
|
||||
name = models.CharField(_('Name'), max_length=255)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Kitchen utility')
|
||||
verbose_name_plural = _('Kitchen utilities')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -51,6 +59,10 @@ class KitchenUtility(models.Model):
|
||||
class Ingredient(models.Model):
|
||||
name = models.CharField(_('Name'), max_length=255)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Ingredient')
|
||||
verbose_name_plural = _('Ingredients')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -58,7 +70,7 @@ class Ingredient(models.Model):
|
||||
class Recipe(models.Model):
|
||||
author = models.ForeignKey(User, models.SET_NULL, null=True)
|
||||
kitchen_utilities = models.ManyToManyField(KitchenUtility,
|
||||
through='UsedKitchenUtilities')
|
||||
through='UsedKitchenUtility')
|
||||
ingredients = models.ManyToManyField(Ingredient, through='UsedIngredient')
|
||||
|
||||
name = models.CharField(_('Name'), max_length=255)
|
||||
@ -82,6 +94,10 @@ class Recipe(models.Model):
|
||||
protein = models.PositiveIntegerField(_('Protein'),
|
||||
help_text=_('How much protein does one portion contain?'))
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Recipe')
|
||||
verbose_name_plural = _('Recipes')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -94,14 +110,20 @@ class RecipeStep(models.Model):
|
||||
|
||||
class Meta:
|
||||
unique_together = ['recipe', 'number_of_step']
|
||||
verbose_name = _('Recipe step')
|
||||
verbose_name_plural = _('Recipe steps')
|
||||
|
||||
|
||||
class UsedKitchenUtilities(models.Model):
|
||||
class UsedKitchenUtility(models.Model):
|
||||
recipe = models.ForeignKey(Recipe, models.CASCADE)
|
||||
kitchen_utility = models.ForeignKey(KitchenUtility, models.CASCADE)
|
||||
amount = models.PositiveIntegerField(_('Amount'),
|
||||
help_text=_('How often is this kitchen utility used?'),
|
||||
default=1)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Used kitchen utility')
|
||||
verbose_name_plural = _('Used kitchen utilities')
|
||||
|
||||
|
||||
class UsedIngredient(models.Model):
|
||||
@ -110,11 +132,19 @@ class UsedIngredient(models.Model):
|
||||
amount = models.PositiveIntegerField(_('Amount'),
|
||||
help_text=_('Please specify the used amount of the ingredient'))
|
||||
unit = models.CharField(_('Unit for amount'), max_length=10, choices=MEASUREMENT_UNITS)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Used ingredient')
|
||||
verbose_name_plural = _('Used ingredients')
|
||||
|
||||
|
||||
class Vendor(models.Model):
|
||||
name = models.CharField(_('Vendor'), max_length=50)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Vendor')
|
||||
verbose_name_plural = _('Vendors')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -130,6 +160,10 @@ class Product(models.Model):
|
||||
price = models.DecimalField(_('Price'), decimal_places=2, max_digits=4,
|
||||
blank=True, default=0.0)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Product')
|
||||
verbose_name_plural = _('Products')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -138,6 +172,10 @@ class Pantry(models.Model):
|
||||
owner = models.ForeignKey(User, models.CASCADE)
|
||||
ingredients = models.ManyToManyField(Ingredient, through='StoredIngredient')
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Pantry')
|
||||
verbose_name_plural = _('Pantries')
|
||||
|
||||
def __str__(self):
|
||||
return str.format('Pantry of {username}',
|
||||
username=self.owner.username)
|
||||
@ -150,3 +188,11 @@ class StoredIngredient(models.Model):
|
||||
help_text=_('Please specify the stored amount of the ingredient'))
|
||||
unit = models.CharField(_('Unit for amount'), max_length=10,
|
||||
choices=MEASUREMENT_UNITS)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Stored ingredient')
|
||||
verbose_name_plural = _('Stored ingredients')
|
||||
|
||||
def __str__(self):
|
||||
return str.format('{amount} {unit} of {ingredient}',
|
||||
amount=self.amount, unit=self.unit, ingredient=self.ingredient)
|
||||
|
||||
Reference in New Issue
Block a user