mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
make 'name' unique in space for MealType
make MealType, Unit, Supermarket, Supermarket Category, PropoertyType case insenstive for get_or_create convert unit conversion create serializer to get_or_create behavior enable create duplicate tests for unitconversion and mealtype api
This commit is contained in:
@@ -982,6 +982,11 @@ class MealType(models.Model, PermissionModelMixin):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['space', 'name'], name='mt_unique_name_per_space'),
|
||||
]
|
||||
|
||||
|
||||
class MealPlan(ExportModelOperationsMixin('meal_plan'), models.Model, PermissionModelMixin):
|
||||
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, blank=True, null=True)
|
||||
|
||||
Reference in New Issue
Block a user