Django 1.9 uses urlpattern.callback; added support while keeping backwards compatibility

This commit is contained in:
Jussi Vaihia 2015-10-01 14:09:42 +03:00
parent 689afd83cc
commit a74b3a711e

View File

@ -24,7 +24,7 @@ def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required):
else: else:
# Regular URL pattern # Regular URL pattern
regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern
view = urlpattern._callback or urlpattern._callback_str view = getattr(urlpattern, 'callback', None) or urlpattern._callback or urlpattern._callback_str
kwargs = urlpattern.default_args kwargs = urlpattern.default_args
name = urlpattern.name name = urlpattern.name
# Add in both the existing and the new urlpattern # Add in both the existing and the new urlpattern