79758841

Date: 2025-09-08 12:03:11
Score: 1
Natty:
Report link

It works now thank you for all of your help;

class homeView(View):
    def get(self, request):
        data = recipemeal.objects.all().order_by("-id")
        
        context ={
            "recipes":data,
            "form":RecipeForm()
        }
        return render(request, "index.html", context)
    
    def post(self, request):
        form = RecipeForm(request.POST)
        
        if form.is_valid():
            form.save()
            return redirect("home")

        data = recipemeal.objects.all().order_by("-id")
        
        context = {
                "recipes": data,
                "form": form
            }
        
        return render(request, "index.html", context)
Reasons:
  • Blacklisted phrase (0.5): thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: DAVE LOVE