Guys, I can not enter, why the function does not work. HTML string:
<a href="/articles/addlike/{{ article.id }}/"><img src="{% static "like.jpg" %}" width="25px" height="25px"></a>{{ article.article_likes }} URL pattern:
urlpatterns = [ url(r'^1/', views.basic_one), url(r'^articles/all/$', views.articles), url(r'^articles/get/(?P<article_id>\d+)/$', views.article), url(r'^', views.articles), url(r'^articles/addlike/(?P<article_id>\d+)/$', views.addlike, name='addlike'), url(r'^articles/addcomment/(?P<article_id>\d+)/$', views.addcomment), ] View:
def addlike(request, article_id): try: article = Article.objects.get(id=article_id) article.article_likes += 1 #в модели поле models.IntegerField(default=0) article.save() except ObjectDoesNotExist: raise Http404 return redirect('/') It does not generate errors, after clicking on the icon on the browser, which should increase the value in the database by 1, everything remains in the same place, the value in the database does not change, the link in the address bar will look like http://127.0.0.1:8000/ articles / addlike / 1 / and everything ... Where to drip?