Создал кнопку удалить, при переделывание в класс кнопка перестала работать, подскажите где я допустил ошибку? Пишу на питоне 3.8.1
view
class ArticleDeleteView(DeleteView):
model = Articles
template_name = 'edit_page.html'
success_url = reverse_lazy('edit_page')
success_msg = 'запись удалена'
def post(self, request,*args,**kwargs):
messages.success(self.request, self.success_msg)
return super().post(request)
edit_page.html
<tbody>
{% for i in list_articles %}
<tr>
<th>{{i.id}}</th>
<td>{{i.create_date}}</td>
<td>{{i.name}}</td>
<td><a href="{% url 'update_page' i.id %}">редактировать</a></td>
<td>
<form id="delete_form" action="{% url 'delete_page' i.id %}" method="post">{% csrf_token %}</form>
<a href="javascript:void()" onclick="delete_question">удалить</a>
<script>
function delete_question() {
if (confirm("Вы уверены")) {
document.getElementById('delete_form').submit()
}
}
</script>
</td>
</tr>
{% endfor %}
</tbody>
urls
from django.contrib import admin
from django.urls import path
from core import views
urlpatterns = [
path('', views.HomeListView.as_view(), name='home'),
path('detail/<int:pk>', views.HomeDetailView.as_view(), name='detail_page'),
path('edit-page', views.ArticleCreateView.as_view(), name='edit_page'),
path('update-page/<int:pk>', views.ArticleUpdateView.as_view(), name='update_page'),
path('delete-page/<int:pk>', views.ArticleDeleteView.as_view(), name='delete_page'),