Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: ['articles/edit/(?P[0-9]+)/$']

前端 未结 1 1163
面向向阳花
面向向阳花 2021-01-21 04:58

I am a beginner in Django and now i am developing a blogging application. At the article editing section i got stucked and I dont know why its showing this error. Searched a lot

相关标签:
1条回答
  • 2021-01-21 05:36

    In your template article_edit.html - post url is expecting a pk, you need to pass a pk just like you are doing it for template my_articles.html

    <div class="create-article"><form class="site-form" action="{% url 'articles:edit' pk=form.instance.pk %}" method="post" enctype="multipart/form-data">{% csrf_token %}...
    

    This way django knows which article you are editing

    0 讨论(0)
提交回复
热议问题