i have 1.8 version
Τη Τρίτη, 19 Ιανουαρίου 2016 - 5:35:09 μ.μ. UTC+2, ο χρήστης Xristos
Xristoou έγραψε:
>
> hello,
>
>
> i want to create a query for likes in my post details
>
> my html tags
>
> <p>{{movies.likes}} peaple liked this article</p>
> <p><a href="/like/{{post.id}}">Like</a></p>
>
>
> my urls
>
>
> url(r'^view/(?P<slug>[^\.]+)/$', views.view_post, name='view_post'),
>
> url(r'^(?P<pk>[0−9]+)/$', views.like_post, name='like_post'),
>
>
> my view
>
>
> def like_post(request,pk=1):
> a=Movies.objects.get(pk=pk)
> count=a.likes
> count+=1
> a.likes=count
> a.save()
> return HttpResponseRedirect ( '/posts/view/%s' % pk)
>
>
> but i have error not work
>
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/like/1/
>
> Using the URLconf defined in categories1.urls, Django tried these URL
> patterns, in this order:
>
> 1. ^admin/
> 2. ^$ [name='index']
> 3. ^view/(?P<slug>[^\.]+)/$[name='view_post']
> 4. ^category/(?P<slug>[\w-]+)/$[name='view_category']
>
> 5. ^(?P<pk>[0−9]+)/$ [name='like_post']
> 6. ^media\/(?P<path>.*)$
>
> The current URL, like/1/, didn't match any of these.
>
>
>
> any idea ?
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/45b26eff-7d76-4961-b605-ab7d8481b2da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.