Skip to content

Commit

Permalink
Merge pull request #33 from ekonstantinidis/fix-reading-urls
Browse files Browse the repository at this point in the history
Catch both cases of common ROOT_URLCONF
  • Loading branch information
ekonstantinidis committed Dec 21, 2015
2 parents 13d0b07 + dd5a310 commit 5da2ab4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rest_framework_docs/__init__.py
@@ -1 +1 @@
__version__ = '0.0.4'
__version__ = '0.0.5'
5 changes: 4 additions & 1 deletion rest_framework_docs/api_docs.py
Expand Up @@ -9,7 +9,10 @@ class ApiDocumentation(object):
def __init__(self):
self.endpoints = []
root_urlconf = __import__(settings.ROOT_URLCONF)
self.get_all_view_names(root_urlconf.urls.urlpatterns)
if hasattr(root_urlconf, 'urls'):
self.get_all_view_names(root_urlconf.urls.urlpatterns)
else:
self.get_all_view_names(root_urlconf.urlpatterns)

def get_all_view_names(self, urlpatterns, parent_pattern=None):
for pattern in urlpatterns:
Expand Down

0 comments on commit 5da2ab4

Please sign in to comment.