1👍
✅
Your </li>
and </a>
is in the incorrect position, it must be:
<li>
<a href ="{% url world:Like pet.id %}">
<img src= "{{ pet.image.url }}" style="cursor:pointer">
</a>
</li>
I added cursor:pointer
in your image
Update:
OK I trace your codes, the problem why your picture do nothing because the like and boat has the same url address
. Why it happen to be the same? even though they have different url name. Notice the address url above in your browser, they both return http://localhost:8000/1/
.
Like url is:
url(
r'^(?P<picture_id>\d+)/$',
'pet.views.Like',
name = 'Like'
),
//which return http://localhost:8000/1/ --> 1 is just a sample id
Boat url is:
url(
r'^(?P<animal_id>\d+)/$',
'pet.views.Like',
name = 'Like'
),
//which return also http://localhost:8000/1/ --> 1 is just a sample id
To make it effective and fix, you must change the url address either one of them like this:
url(
r'^like/(?P<picture_id>\d+)/$',
'pet.views.Like',
name = 'Like'
),
//which return now as http://localhost:8000/like/1/
Source:stackexchange.com