Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path for nested urls.py files not properly built. #144

Open
StyXman opened this issue Nov 3, 2016 · 0 comments
Open

Path for nested urls.py files not properly built. #144

StyXman opened this issue Nov 3, 2016 · 0 comments

Comments

@StyXman
Copy link
Contributor

StyXman commented Nov 3, 2016

I have a project level nestor/urls.py file like this:

urlpatterns = [
    url(r'^v1/', include('nestor.v1.urls', namespace='api-v1')),
    url(r'^docs/', include('rest_framework_docs.urls', namespace='api-docs')),
]

Then nestor/v1/urls.py like:

router = rest_framework.routers.DefaultRouter()

router.register('node', Node, base_name='node')
router.register('vm', VirtualMachine, base_name='vm')
router.register('ldev', LDev, base_name='ldev')

# BUG: DRFDocs is not picking up the nesting properly
urlpatterns = [
    url(r'^', include(router.urls)),
]

The generated URLs in the doc look like:

/node/
/node/<pk>/
/vm/
/vm/<pk>/
/vm/<pk>/reboot/
/ldev/
/

Clearly, the v1/ prefix is missing. I think the culprit is the recursive part of the endpoint generator:

https://github.com/manosim/django-rest-framework-docs/blob/master/rest_framework_docs/api_docs.py#L27

In that line, the parent_patter that was carried in the recursive call is replaced and not accumulated.

Also, I have the impression that @manosim has stopped working on the package.

@StyXman StyXman changed the title Path for recursive urls.py files not properly built Path for nested urls.py files not properly built. Nov 3, 2016
StyXman added a commit that referenced this issue Dec 23, 2016
mingfeng pushed a commit to mingfeng/parkkihubi that referenced this issue Jan 25, 2017
Install drfdocs from GitHub repo. The latest release (pypi) version for drfdocs has a bug which affects auto generated
docs[1].

Refs: [1] manosim/django-rest-framework-docs#144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant