recamshak / django-debug-panel

django-debug-toolbar in WebKit DevTools. Works fine with background Ajax requests and non-HTML responses.
BSD 3-Clause "New" or "Revised" License
404 stars 69 forks source link

Update urls.py for Django 1.10 compatibility #14

Closed wli closed 8 years ago

wli commented 8 years ago

This fixes urls.py so that the following errors do not come up when using Django 1.9:

debug_panel/urls.py:15: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
  url(r'^%s/data/(?P<cache_key>\d+\.\d+)/$' % _PREFIX, 'debug_data', name='debug_data'),

debug_panel/urls.py:15: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got debug_data). Pass the callable instead.
  url(r'^%s/data/(?P<cache_key>\d+\.\d+)/$' % _PREFIX, 'debug_data', name='debug_data'),
recamshak commented 8 years ago

Thanks for the PR. I think it's better to simply avoid the use of patterns. See https://github.com/recamshak/django-debug-panel/commit/b9c86fd3d44b465e56dab6d54026f40980cbcbea

wli commented 8 years ago

That's perfectly fine, but then it won't support older django versions. You have a comment in there that supports Django 1.4, so I figured we should maintain compatibility. Totally fine to drop support for those old versions though :)

recamshak commented 8 years ago

It is compatible with all previous version of Django. pattern is just a helper function that add a prefix to the url's view path. It's not mandatory to use it, even on older Django version. (https://github.com/django/django/blob/1.4/django/conf/urls/__init__.py#L39)

wli commented 8 years ago

Ah okay, didn't know that. Thanks for the clarification!