Ticket #10745: url-tag-variable-view-name.diff
File url-tag-variable-view-name.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/template/defaulttags.py
352 352 353 353 class URLNode(Node): 354 354 def __init__(self, view_name, args, kwargs, asvar): 355 self.view_name = view_name355 self.view_name = Variable(view_name) 356 356 self.args = args 357 357 self.kwargs = kwargs 358 358 self.asvar = asvar … … 369 369 # {% url ... as var %} construct in which cause return nothing. 370 370 url = '' 371 371 try: 372 url = reverse(self.view_name , args=args, kwargs=kwargs)372 url = reverse(self.view_name.resolve(context), args=args, kwargs=kwargs) 373 373 except NoReverseMatch, e: 374 374 if settings.SETTINGS_MODULE: 375 375 project_name = settings.SETTINGS_MODULE.split('.')[0] 376 376 try: 377 url = reverse(project_name + '.' + self.view_name ,377 url = reverse(project_name + '.' + self.view_name.resolve(context), 378 378 args=args, kwargs=kwargs) 379 379 except NoReverseMatch: 380 380 if self.asvar is None: