I see, so I cannot use {% url %} in this case. Thanks!


On Dec 1, 3:53 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2008-11-30 at 23:42 -0800, Roy wrote:
> > Hi,
>
> > I have the following in one of my templates:
> > <a href="{% url comments-flag comment.id,object.get_absolute_url
> > %}">Flag</a>
>
> > But I'm getting a TemplateSyntaxError:
>
> > Caught an exception while rendering: Reverse for 'mysite.comments-
> > flag' with arguments '(<comment.id>, '<the object.get_absolute_url>')'
> > and keyword arguments '{}' not found
>
> > The named url "comments-flag" comes from
> > django.contrib.comments.urls.py:
>
> > url(r'^flag/(\d+)/$',    'moderation.flag',             name='comments-
> > flag'),
>
> This URL pattern only accepts a single parameter (an integer). You are
> passing in two parameters, so it won't match this pattern. The fact that
> your view takes an option second parameter is irrelevant to this
> situation, since Django is only comparing against the regular expression
> pattern.
>
> I'm guessing a little bit, but it looks like (from the name) that you're
> wanting the second parameter to be used as a query string in the
> resulting URL. The "url" template tag cannot construct URLs that use
> querystrings like that. You would need to write your own tag that knew
> to use the first N parameters in a call to reverse() to construct the
> first portion of the URL and then the remaining parameters were used to
> construct the query string.
>
> Regards,
> Malcolm

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to