Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions django_js_utils/management/commands/js_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

RE_KWARG = re.compile(r"(\(\?P\<(.*?)\>.*?\))") #Pattern for recongnizing named parameters in urls
RE_ARG = re.compile(r"(\(.*?\))") #Pattern for recognizing unnamed url parameters


class Command(BaseCommand):
def handle(self, *args, **options):
Expand All @@ -27,7 +27,7 @@ def handle(self, *args, **options):
urls_file.write("dutils.conf.urls = ")
simplejson.dump(js_patterns, urls_file)
print "Done generating Javascript urls file %s" % app_settings.URLS_JS_GENERATED_FILE

@staticmethod
def handle_url_module(js_patterns, module_name, prefix=""):
"""
Expand Down Expand Up @@ -62,4 +62,7 @@ def handle_url_module(js_patterns, module_name, prefix=""):
js_patterns[pattern.name] = "/" + full_url
elif issubclass(pattern.__class__, RegexURLResolver):
if pattern.urlconf_name:
Command.handle_url_module(js_patterns, pattern.urlconf_name, prefix=pattern.regex.pattern)

#Added prefix + pattern
#Reason : Prefix now appends recursively
Command.handle_url_module(js_patterns, pattern.urlconf_name, prefix=prefix+pattern.regex.pattern)