Re: reverse() with keyword argument driving me batty
Your URLconf is broken. The (?P) regex fragment gives you a keyword argument of jobkey, but it only matches a zero length string. You need to include a regex to specify what you want jobkey to match. (?P[0-9a-fA-F]*) Cheers, Cliff On Thu, 2012-01-12 at 09:50 -0800, John DeRosa wrote: > Hi all, > > I'm running Django 1.3, and I can't get a simple reverse() with keywords to > work. > > My urlconf has this: > >url(r'^results/text/(?P)/$', 'textresults', > name='exporttextresults') > > My code does this > >exporturl = reverse("exporttextresults", kwargs={"jobkey": > returned_key}) > > And I get this error: > >*** NoReverseMatch: Reverse for 'exporttextresults' with arguments > '()' and keyword arguments '{'jobkey': > '40756766e8de9e0994536cf11773267d469c3a4ed77da53e89b8bc1de6c9'}' not > found. > > > What's the right calling sequence for a reverse to an URL with a keyword > argument? > > Thanks, > > John > -- 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.
Re: reverse() with keyword argument driving me batty
On Jan 12, 2012, at 10:18 AM, Andy McKay wrote: > On Thu, Jan 12, 2012 at 9:50 AM, John DeRosa wrote: >> url(r'^results/text/(?P)/$', 'textresults', >> name='exporttextresults') > > One guess, you haven't specified what the (?P in your regex accepts. > For example: > (?P\w+) > Gah! I am an imbecile! Now I know why Mozilla never hired me! Thanks!!! John -- 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.
Re: reverse() with keyword argument driving me batty
On Thu, Jan 12, 2012 at 9:50 AM, John DeRosa wrote: > url(r'^results/text/(?P)/$', 'textresults', > name='exporttextresults') One guess, you haven't specified what the (?P in your regex accepts. For example: (?P\w+) -- 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.
reverse() with keyword argument driving me batty
Hi all, I'm running Django 1.3, and I can't get a simple reverse() with keywords to work. My urlconf has this: url(r'^results/text/(?P)/$', 'textresults', name='exporttextresults') My code does this: exporturl = reverse("exporttextresults", kwargs={"jobkey": returned_key}) And I get this error: *** NoReverseMatch: Reverse for 'exporttextresults' with arguments '()' and keyword arguments '{'jobkey': '40756766e8de9e0994536cf11773267d469c3a4ed77da53e89b8bc1de6c9'}' not found. What's the right calling sequence for a reverse to an URL with a keyword argument? Thanks, John -- 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.