On Sat, Apr 23, 2011 at 3:31 AM, Ryan Osborn <ryan.osbor...@gmail.com> wrote: > You could always make the payment_id group optional using a ?: > > update_payment/(?P<payment_id>\w+)?
Ryan, Thanks. I considered that first, but rejected it because I want the extra field to be required. If it's missing then it's an error. Giving it a default in the view definition means extra code in all effected views, which isn't DRY. Also a bug caused by missing parameters that cause an error is more subtle than the (admittedly ugly) "duplicate" url pattern. I was hoping that, since the url tag, named URLs, and URLs with extra parameters are all baked-in parts of Django that Django would have a canonical way to deal with this, since URLs built based on user actions are a very old technique. It seems like someone must have run into this before me. It occurs to me now that I could just use a placeholder, and replace that in JavaScript: <a href="{% url update_payment 'payment_id' %}">Update Payment</a> Then use the JavaScript to replace the string 'payment_id' (or a regex on its location in the URL) when the user takes action. It also moves all of the logic out of views and urls, which I think is probably best. Shawn -- 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.