Приветствую! Такая же проблема только на Джанго 2.0. При нажатии на лайк выбрасывает на страницу с ошибкой
"Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/article/addlike/1/
Using the URLconf defined in mysiteseven.urls, Django tried these URL patterns, in this order:
admin/
basicview/
1/
2/
3/
articles/all/
articles/get/<int:article_id>/
articles/addlike/<int:article_id>/
The current path, article/addlike/1/, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page."
во вьюшке функция такая:
def addlike(request, article_id):
try:
article = Article.objects.get(id=article_id)
article.article_likes += 1
article.save()
except ObjectDoesNotExist:
raise Http404
return redirect('/')
юрлы такие:
from django.urls import path, include
from . import views
urlpatterns = [
path('1/', views.basic_one),
path('2/', views.template_two),
path('3/', views.template_three_simple),
path('articles/all/', views.articles),
path('articles/get/<int:article_id>/', views.article),
path('articles/addlike/<int:article_id>/', views.addlike),
path('', views.articles),
шаблон:
{% extends 'main.html' %}
{% load staticfiles %}
{% block article %}
<div class="large-8 columns">
{% for article in articles %}
<h6>Дата публикации: {{ article.article_date }}</h6>
<h4><a href="/articles/get/{{ article.id }}/"> {{ article.article_title }}</a></h4>
<p>{{ article.article_text }}</p>
<p><a href="/article/addlike/{{ article.id }}/"> <img src="{% static "images.png" %}" width="25px" height="25px"></a> {{ article.article_likes }}</p>
<hr>
{% endfor %}
</div>
{% endblock %}
помогите плз(