def _make_patterns(*patterns): result = [] shorthands = settings.COMPETITION_URLS for competition_id, url_path_prefix in shorthands.iteritems(): for _regex, view in patterns: regex = '^' + join_urls(url_path_prefix, _regex) result.append(url(regex, view, {'competition_id': competition_id})) for _regex, view in patterns: regex = join_urls(r'^competition/(?P<competition_id>\d+)/', _regex) result.append(url(regex, view)) return result
def get_scoreboard_url(self): return join_urls(self.get_absolute_url(), 'scoreboard')
def get_registration_url(self): # Can this be achieved with Django's URL reversing? # (self.url_path_prefix is the problem here...) return join_urls(self.get_absolute_url(), 'registration')