Skip to content

Project level urls delegation and app level router #4487

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

Closed
6 tasks done
c17r opened this issue Sep 14, 2016 · 1 comment
Closed
6 tasks done

Project level urls delegation and app level router #4487

c17r opened this issue Sep 14, 2016 · 1 comment
Labels
Milestone

Comments

@c17r
Copy link

c17r commented Sep 14, 2016

Checklist

  • I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

in project level urls.py

from django.conf.urls import url, include

urlpatterns = [
    url(r'myapp/', include('myapp.urls')),
]

in myapp/urls.py

from django.conf.urls import url, include
from rest_framework import routers

from myapp import views

router = routers.SimpleRouter()
router.register(r'', views.MyAppViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
]

Expected behavior

Calls to /myapp/ and /myapp/1/ work

Actual behavior

2 warnings:

  • ?: (urls.W002) Your URL pattern '^/$' [name='myapp-list'] has a regex beginning with a '/'. Remove this slash as it is unnecessary.
  • ?: (urls.W002) Your URL pattern '^/(?P[^/.]+)/$' [name='myapp-detail'] has a regex beginning with a '/'. Remove this slash as it is unnecessary.

and the urls are actually /myapp// and /myapp//1

failing test cases at #4486

@tomchristie tomchristie modified the milestones: 3.4.7 Release, 3.4.8 Release Sep 15, 2016
@tomchristie tomchristie modified the milestones: 3.4.8 Release, 3.5.0 Release Sep 29, 2016
@tomchristie
Copy link
Member

Closed via #4486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants