I am trying to use Ajax to submit a like button, I believe everything is in order but I keep getting django.urls.exceptions.NoReverseMatch: Reverse for 'like_post' with arguments '('',)' not found. 1 pattern(s) tried: ['score/like/(?P<pk>[0-9]+)$']
I am not sure what is the reason. Need help to identify the error.
Here is the view
Here is the url.py updated
urlpatterns = [
here is the template
<form class="mt-0" action="{% url 'score:like_post' post.pk %}" method='POST'>
here is the ajax
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5aaa1274-dd6b-42bc-8a5e-bce4596ace98%40googlegroups.com.
button标签中的type属性设置为button,
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6aa0bb16-9ded-4ad6-8ffa-5d82713ec7ad%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHV4E-dvD0y2Ocv0sfshUop%2BbczugiS%3DSux7W%2BU3VTSuqwsccg%40mail.gmail.com.