0

Web Programming Project 1. I can't figure out what is causing this error. Tried searching for an answer everywhere.

Error Message
Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: ['edit/(?P[^/]+)$']

urls.py

from django.urls import path

from . import views

urlpatterns = [
    path("", views.index, name="index"),
    path("wiki/<str:entry>", views.entry, name="entry"),
    path("search", views.search, name="search"),
    path("newpage", views.newpage, name="newpage"),
    path("edit/<str:entry>", views.edit, name="edit")
]

views.py

def edit(request, entry):
    entryPage = util.get_entry(entry)
    if entryPage is None:
        return render(request, "encyclopedia/error.html", {
            "entryTitle": entry
        })
    else:
        form = NewPageForm()
        form.fields["title"].initial = entry
        form.fields["content"].intial = entryPage
        return render(request, "encyclopedia/newpage.html", {
            "form": form
        })

page.html

{% extends "encyclopedia/layout.html" %}

{% block title %}
   {{ entryTitle }}
{% endblock %}

{% block body%}
    {{entry|safe}}
    <a href="{% url 'edit' %}" class="btn btn-primary">Edit Page</a>
{% endblock %}

You must log in to answer this question.

Browse other questions tagged .