Skip to content Skip to sidebar Skip to footer

Typeerror At /edit : Edit() Missing 1 Required Positional Argument: 'entry'

I am very new at Django and I am working on a web app project. this particular page is supposed to edit an entry and save the entry. but I keep getting the missing 1 required argum

Solution 1:

The problem is in your urls.py file in this line:

 path("edit", views.edit, name="edit"),

because views.edit is expecting that you must provide two-parameter request and entry in your url. And in your case entry is missing. Try to add entry in your urlspatterns path, in this case, I'm expecting your entry is int.

path("edit/<int:entry>", views.edit, name="edit"),

and this entry can be your model pk or anything else you want. After modifying your urlspatterns whenever you call edit view in your html you need to do this:

{% url 'edit' entry=your_entry_value %}

instead of:

{% url 'edit' %} 

Post a Comment for "Typeerror At /edit : Edit() Missing 1 Required Positional Argument: 'entry'"