pinax-likes icon indicating copy to clipboard operation
pinax-likes copied to clipboard

HTTP ERROR 405

Open HelloGit100 opened this issue 5 years ago • 4 comments

Django 2.2.1

The steps are as follows:

  • pip3 install pinax-likes

  • Added 'pinax.likes', to the project's settings.py file, then added:

PINAX_LIKES_LIKABLE_MODELS = {
    "app.Post": {}
}
  • Added
re_path(r'^likes/', include(('pinax.likes.urls', 'pinax_likes'), namespace='pinax_likes')),

to the project's urls.py file,

  • Download the files in the https://github.com/pinax/pinax-templates/tree/master/pinax/templates/templates/pinax/likes,

put these html files in /home/www/venv/templates/pinax/likes/,

  • Added
{% load pinax_likes_tags %}
{% likes_widget request.user post %}

to the post.html file,

  • python manage.py makemigrations app && python manage.py migrate && python manage.py runserver 0.0.0.0:8000

  • Open http://127.0.0.1:8000/post/13/, like icon appears, when clicked the icon(url: http://127.0.0.1:8000/like/14:13/), show the following: HTTP ERROR 405,

The console displays the following information:

Method Not Allowed (GET): /likes/like/14:13/ Method Not Allowed: /likes/like/14:13/ [29/May/2019 10:00:00] "GET /likes/like/14:13/ HTTP/1.1" 405 0

  • Then i added <script src="{% static 'eldarion-ajax.min.js' %}"></script> in base.html,

After clicked the icon, the console displays the following information:

Forbidden (CSRF token missing or incorrect.): /likes/like/14:13/ [29/May/2019 10:01:31] "POST /likes/like/14:13/ HTTP/1.1" 403 2513

What are the steps wrong? Thank you!

HelloGit100 avatar May 29 '19 10:05 HelloGit100

Not sure answer atm, but looks you had similar problem as @agiledesign2.

KatherineMichel avatar Aug 31 '19 07:08 KatherineMichel

@HelloGit100 Did you end up finding a solution, or unresolved?

KatherineMichel avatar Jan 05 '20 02:01 KatherineMichel

Hello @agiledesign2 has posted a solution to his issue. Perhaps, this would solve your problem as well: https://github.com/pinax/pinax-likes/issues/57

KatherineMichel avatar Jun 22 '20 19:06 KatherineMichel

I added this to the html header to solve issue for me <script src="{% static "js/jquery.min.js" %}" >

mikai-com avatar Sep 10 '20 20:09 mikai-com