Re: problem with get_absolute_url
Thanks Mike for the reply.
I rewrote the method as
@models.permalink
def get_absolute_url(self):
return("myapp_entry_detail",(),{'id':self.id})
When I go to the admin interface's edit page for an entry and click
the viewsite button it causes the following error,
NoReverseMatch,Reverse for 'myapp_entry_detail' with arguments '()'
and keyword arguments '{'id': 6}' not found.
When I try in browser http://127.0.0.1:8000/myapp/1/ causes
ValueError,dictionary update sequence element #0 has length 1; 2 is
required
is this caused by the name 'myapp_entry_detail' in the urlpattern
below?
(r'^(?P<id>\d+)/$','myapp.views.entry_detail','myapp_entry_detail'),
The following is the entry_detail method which I defined
def entry_detail(request,id):
entry=MyEntry.objects.get(id=id)
entry_detail_dict={'object':entry}
return render_to_response('myapp/
myentry_detail.html',entry_detail_dict)
I can't figure out why these errors are occuring..Everything works
fine when I hardcode the url and omit the name 'myapp_entry_detail' in
the urlpattern.If I don't omit that name in urlpattern ,the Request
URL http://127.0.0.1:8000/myapp/1/ causes the ValueError which I
mentioned earlier.
Any help will be much appreciated
thanks
jim
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home