On Jul 28, 12:18 pm, gentlestone <tibor.b...@hotmail.com> wrote: > Hello, > > I've got this exception > ------------------------ > Reverse for 'view' with arguments '('13',)' and keyword arguments '{}' > not found. > ------------------------ > This is my code: > ------------------------ > from django.db.models import permalink > .... > # def get_absolute_url(self): > # return "/resys/katalog/kategoria/" + str(self.id) > def get_absolute_url(self): > return ('view', [str(self.id)]) > get_absolute_url = permalink(get_absolute_url) > -------------- > if I change the uncomented code to commented, it works perfectly, but > the commented code is not DRY. The URL code is: > ------------------- > urlpatterns = patterns( > 'django.views.generic.list_detail', > ( > r'^kategorie/(?P<page>[0-9]+)/$', > 'object_list', > { > 'queryset' : Kategoria.objects.all(), > 'paginate_by' : page_range, > }, > 'list', > ), > ) > > urlpatterns += patterns( > 'django.views.generic.simple', > ( > r'^kategoria/(?P<object_id>\d+)/$', > 'redirect_to', > { > 'url': reverse( > 'list', > args = [1] > ) > }, > 'view' > ), > ) > ---------------------- > > Any suggestions?
Your 'view' URL doesn't take args, it takes kwargs. So the lookup should be: return ('view', (), {'object_id': self.id}) -- DR. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---