0

I keep getting - TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries": util.save_entry(title, content) }))

My code is as follows:

        
        def add(request):
              if request.method == "POST":
                 form = NewTaskForm(request.POST)
                 title = request.POST.get("title")
                 content = request.POST.get("content")
                 if form.is_valid():
                    request.session["entries"] = []
                        return HttpResponseRedirect (reverse("encyclopedia:index", {
                        "entries": util.save_entry(title, content)
                    }))
                 else:
                    return render(request, "encyclopedia/add.html", {
                        "form": form
                    })
              else:
                    return render(request, "encyclopedia/add.html", {
                        "form": NewTaskForm()
                    })

Could you please provide your suggestions? Thanks!

1
0

did you manage to get a solution to this problem? I am having the same problem and honestly I don't know how to solve it.

1
  • 1
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – MARS Nov 12 '20 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .