mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 23:28:16 -05:00
Merge branch 'develop' into feature/vue3
# Conflicts: # .gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -87,4 +87,5 @@ vue/webpack-stats.json
|
|||||||
cookbook/templates/sw.js
|
cookbook/templates/sw.js
|
||||||
.prettierignore
|
.prettierignore
|
||||||
vue/.yarn
|
vue/.yarn
|
||||||
|
vue3/.vite
|
||||||
vue3/node_modules
|
vue3/node_modules
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-02-24 12:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('cookbook', '0213_remove_property_property_unique_import_food_per_space_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='cooklog',
|
||||||
|
name='comment',
|
||||||
|
field=models.TextField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='cooklog',
|
||||||
|
name='updated_at',
|
||||||
|
field=models.DateTimeField(auto_now=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='cooklog',
|
||||||
|
name='rating',
|
||||||
|
field=models.IntegerField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='cooklog',
|
||||||
|
name='servings',
|
||||||
|
field=models.IntegerField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1293,10 +1293,13 @@ class TelegramBot(models.Model, PermissionModelMixin):
|
|||||||
|
|
||||||
class CookLog(ExportModelOperationsMixin('cook_log'), models.Model, PermissionModelMixin):
|
class CookLog(ExportModelOperationsMixin('cook_log'), models.Model, PermissionModelMixin):
|
||||||
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
|
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
|
||||||
|
rating = models.IntegerField(null=True, blank=True)
|
||||||
|
servings = models.IntegerField(null=True, blank=True)
|
||||||
|
comment = models.TextField(null=True, blank=True)
|
||||||
|
|
||||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
created_at = models.DateTimeField(default=timezone.now)
|
created_at = models.DateTimeField(default=timezone.now)
|
||||||
rating = models.IntegerField(null=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
servings = models.IntegerField(default=0)
|
|
||||||
|
|
||||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
||||||
objects = ScopedManager(space='space')
|
objects = ScopedManager(space='space')
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ class UserSpaceSerializer(WritableNestedModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = UserSpace
|
model = UserSpace
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'user', 'space', 'groups', 'active', 'internal_note', 'invite_link', 'created_at', 'updated_at',)
|
'id', 'user', 'space', 'groups', 'active', 'internal_note', 'invite_link', 'created_at', 'updated_at',)
|
||||||
read_only_fields = ('id', 'invite_link', 'created_at', 'updated_at', 'space')
|
read_only_fields = ('id', 'invite_link', 'created_at', 'updated_at', 'space')
|
||||||
|
|
||||||
|
|
||||||
@@ -772,8 +772,7 @@ class IngredientSerializer(IngredientSimpleSerializer):
|
|||||||
|
|
||||||
class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
|
class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
|
||||||
ingredients = IngredientSerializer(many=True)
|
ingredients = IngredientSerializer(many=True)
|
||||||
ingredients_markdown = serializers.SerializerMethodField('get_ingredients_markdown')
|
instructions_markdown = serializers.SerializerMethodField('get_instructions_markdown')
|
||||||
ingredients_vue = serializers.SerializerMethodField('get_ingredients_vue')
|
|
||||||
file = UserFileViewSerializer(allow_null=True, required=False)
|
file = UserFileViewSerializer(allow_null=True, required=False)
|
||||||
step_recipe_data = serializers.SerializerMethodField('get_step_recipe_data')
|
step_recipe_data = serializers.SerializerMethodField('get_step_recipe_data')
|
||||||
recipe_filter = 'steps'
|
recipe_filter = 'steps'
|
||||||
@@ -782,10 +781,7 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
|
|||||||
validated_data['space'] = self.context['request'].space
|
validated_data['space'] = self.context['request'].space
|
||||||
return super().create(validated_data)
|
return super().create(validated_data)
|
||||||
|
|
||||||
def get_ingredients_vue(self, obj):
|
def get_instructions_markdown(self, obj):
|
||||||
return obj.get_instruction_render()
|
|
||||||
|
|
||||||
def get_ingredients_markdown(self, obj):
|
|
||||||
return obj.get_instruction_render()
|
return obj.get_instruction_render()
|
||||||
|
|
||||||
def get_step_recipes(self, obj):
|
def get_step_recipes(self, obj):
|
||||||
@@ -800,8 +796,8 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Step
|
model = Step
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'name', 'instruction', 'ingredients', 'ingredients_markdown',
|
'id', 'name', 'instruction', 'ingredients', 'instructions_markdown',
|
||||||
'ingredients_vue', 'time', 'order', 'show_as_header', 'file', 'step_recipe',
|
'time', 'order', 'show_as_header', 'file', 'step_recipe',
|
||||||
'step_recipe_data', 'numrecipe', 'show_ingredients_table'
|
'step_recipe_data', 'numrecipe', 'show_ingredients_table'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -846,7 +842,7 @@ class UnitConversionSerializer(WritableNestedModelSerializer, OpenDataModelMixin
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = UnitConversion
|
model = UnitConversion
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'name', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food', 'open_data_slug')
|
'id', 'name', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food', 'open_data_slug')
|
||||||
|
|
||||||
|
|
||||||
class NutritionInformationSerializer(serializers.ModelSerializer):
|
class NutritionInformationSerializer(serializers.ModelSerializer):
|
||||||
@@ -873,6 +869,13 @@ class RecipeBaseSerializer(WritableNestedModelSerializer):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class CommentSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Comment
|
||||||
|
fields = '__all__'
|
||||||
|
read_only_fields = ['id', 'created_at', 'created_by', 'updated_at', ]
|
||||||
|
|
||||||
|
|
||||||
class RecipeOverviewSerializer(RecipeBaseSerializer):
|
class RecipeOverviewSerializer(RecipeBaseSerializer):
|
||||||
keywords = KeywordLabelSerializer(many=True)
|
keywords = KeywordLabelSerializer(many=True)
|
||||||
new = serializers.SerializerMethodField('is_recipe_new')
|
new = serializers.SerializerMethodField('is_recipe_new')
|
||||||
@@ -950,12 +953,6 @@ class RecipeImportSerializer(SpacedModelSerializer):
|
|||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
|
||||||
class CommentSerializer(serializers.ModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = Comment
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
|
|
||||||
class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
||||||
shared = UserSerializer(many=True, required=False)
|
shared = UserSerializer(many=True, required=False)
|
||||||
|
|
||||||
@@ -1150,7 +1147,7 @@ class ShoppingListEntrySerializer(WritableNestedModelSerializer):
|
|||||||
'recipe_mealplan',
|
'recipe_mealplan',
|
||||||
'created_by', 'created_at', 'updated_at', 'completed_at', 'delay_until'
|
'created_by', 'created_at', 'updated_at', 'completed_at', 'delay_until'
|
||||||
)
|
)
|
||||||
read_only_fields = ('id', 'created_by', 'created_at','updated_at',)
|
read_only_fields = ('id', 'created_by', 'created_at', 'updated_at',)
|
||||||
|
|
||||||
|
|
||||||
class ShoppingListEntryBulkSerializer(serializers.Serializer):
|
class ShoppingListEntryBulkSerializer(serializers.Serializer):
|
||||||
@@ -1203,6 +1200,8 @@ class ShareLinkSerializer(SpacedModelSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class CookLogSerializer(serializers.ModelSerializer):
|
class CookLogSerializer(serializers.ModelSerializer):
|
||||||
|
created_by = UserSerializer(read_only=True)
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
validated_data['created_by'] = self.context['request'].user
|
validated_data['created_by'] = self.context['request'].user
|
||||||
validated_data['space'] = self.context['request'].space
|
validated_data['space'] = self.context['request'].space
|
||||||
@@ -1210,7 +1209,7 @@ class CookLogSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CookLog
|
model = CookLog
|
||||||
fields = ('id', 'recipe', 'servings', 'rating', 'created_by', 'created_at')
|
fields = ('id', 'recipe', 'servings', 'rating', 'comment', 'created_by', 'created_at', 'updated_at')
|
||||||
read_only_fields = ('id', 'created_by')
|
read_only_fields = ('id', 'created_by')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1270,8 +1270,13 @@ class CookLogViewSet(viewsets.ModelViewSet):
|
|||||||
serializer_class = CookLogSerializer
|
serializer_class = CookLogSerializer
|
||||||
permission_classes = [CustomIsOwner & CustomTokenHasReadWriteScope]
|
permission_classes = [CustomIsOwner & CustomTokenHasReadWriteScope]
|
||||||
pagination_class = DefaultPagination
|
pagination_class = DefaultPagination
|
||||||
|
query_params = [
|
||||||
|
QueryParam(name='recipe', description=_('Filter for entries with the given recipe'), qtype='integer'),
|
||||||
|
]
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
if self.request.query_params.get('recipe', None):
|
||||||
|
self.queryset = self.queryset.filter(recipe=self.request.query_params.get('recipe'))
|
||||||
return self.queryset.filter(space=self.request.space)
|
return self.queryset.filter(space=self.request.space)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<!-- step text -->
|
<!-- step text -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
<compile-component :code="step.ingredients_markdown"
|
<compile-component :code="step.instructions_markdown"
|
||||||
:ingredient_factor="ingredient_factor"></compile-component>
|
:ingredient_factor="ingredient_factor"></compile-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2878,7 +2878,7 @@ export interface RecipeSteps {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof RecipeSteps
|
* @memberof RecipeSteps
|
||||||
*/
|
*/
|
||||||
ingredients_markdown?: string;
|
instructions_markdown?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -3731,7 +3731,7 @@ export interface Step {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof Step
|
* @memberof Step
|
||||||
*/
|
*/
|
||||||
ingredients_markdown?: string;
|
instructions_markdown?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
|||||||
Reference in New Issue
Block a user