Skip to content

jQuery category like button doesn't work as expected #7

@piotrsynowiec

Description

@piotrsynowiec

On Django 2.2 this doesn't work as expected:

“Don’t forget to add in the URL mapping, into rango/urls.py. Update the urlpatterns by adding in:

path('like$', views.like_category, name='like_category'),”

I read the docs and tried this:
re_path(r'^like/$', views.like_category, name="like_category"),

and it kind of works, but after the first like, every time I refresh once liked category, refresh automatically adds +1 to the number of likes.

In the console it's visible that opening/refreshing the category is requesting 'like_category' view at the same time:

[12/Jul/2019 19:39:02] "GET /rango/like/?category_id=5 HTTP/1.1" 200 2
[12/Jul/2019 19:39:02] "GET /rango/category/python/ HTTP/1.1" 200 6311

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions