I have a photo page needed connecting each photo to different URL.
----------------------------------------------------------
The URL as below:
url(r'^gallery/(?P<item_id>\d+)/(?P<photo_id>\d+)/$', zoom_photo)
The view as below:
def zoom_photo(request, item_id, photo_id):
item = Item.objects.get(id=item_id)
photo = item.photo_set.all[photo_id]
t = loader.get_template("zoom_photo.html")
c = Context({'photo':photo})
return HttpResponse(t.render(c))
------------------------------------------------------------
When I enter the URL such as http://127.0.0.1:8000/blog/gallery/1/1/
it shows a error
Exception Type: TypeError
Exception Value:
'instancemethod' object is not subscriptable
Exception Location: C:\Python27\Lib\site-packages\django\bin\mysite\..
\mysite\blog\views.py in zoom_photo, line 27
-----------------------------------------------------------
In the first, I think change the photo_id to int(photo_id), but the
error is the same as above. I have no idea how to solve.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.