Self hosted FLOSS fitness/workout, nutrition and weight tracker
Fixed the nutrition plan copy bug
JayanthBonthab76a8b9a4a5a
diff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.pyindex f2e20f261..94cdfe4d0 100644--- a/wger/nutrition/views/plan.py+++ b/wger/nutrition/views/plan.py@@ -68,7 +68,7 @@ def copy(request, pk):plan = get_object_or_404(NutritionPlan, pk=pk, user=request.user)# Copy plan- meals = plan.meal_set.all()+ meals = plan.meal_set.select_related()plan_copy = planplan_copy.pk = None@@ -76,7 +76,7 @@ def copy(request, pk):# Copy the mealsfor meal in meals:- meal_items = meal.mealitem_set.all()+ meal_items = meal.mealitem_set.select_related()meal_copy = mealmeal_copy.pk = None@@ -88,7 +88,7 @@ def copy(request, pk):item_copy = itemitem_copy.pk = Noneitem_copy.meal = meal_copy- item.save()+ item_copy.save()# Redirectreturn HttpResponseRedirect(reverse('nutrition:plan:view', kwargs={'id': plan.id}))