-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added two different url registration to tests
- Loading branch information
1 parent
0c26090
commit c0327ab
Showing
3 changed files
with
88 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,52 @@ | ||
# Default Django's url registration | ||
from django_routify import include_router | ||
from django.urls import path, include | ||
from .views import home, HomeRedirectView, HelloNameView | ||
from .views import ( | ||
home, | ||
HomeRedirectView, | ||
HelloNameView, | ||
router_with_trailing, | ||
routify_without_trailing, | ||
) | ||
|
||
default_urlpatterns = [ | ||
# Default Django's url registration with trailing slash | ||
default_with_trailing_urlpatterns = [ | ||
path( | ||
'test/', # url prefix | ||
'test/', # url prefix '<host:port>/test/' | ||
include(( | ||
[ | ||
path('home/', home, name='home'), | ||
path('', HomeRedirectView.as_view(), name='home_redirect'), | ||
path('<slug:name>/', HelloNameView.as_view(), name='hello_name'), | ||
path('home/', home, name='home'), # '<host:port>/test/home/' | ||
path('', HomeRedirectView.as_view(), name='home_redirect'), # '<host:port>/test/' | ||
path('<slug:name>/', HelloNameView.as_view(), name='hello_name'), # '<host:port>/test/<slug:name>/' | ||
], # urlpatterns | ||
'test', # app_name | ||
)) | ||
), | ||
] | ||
|
||
|
||
# Django Routify url registration | ||
from django_routify import include_router | ||
from .views import router | ||
# Django Routify url registration with trailing slash | ||
routify_with_trailing_urlpatterns = [ | ||
include_router(router_with_trailing), | ||
] | ||
|
||
|
||
# Default Django's url registration with trailing slash | ||
default_without_trailing_urlpatterns = [ | ||
path( | ||
'test', # url prefix '<host:port>/test' | ||
include(( | ||
[ | ||
path('/home', home, name='home'), # '<host:port>/test/home' | ||
path('', HomeRedirectView.as_view(), name='home_redirect'), # '<host:port>/test' | ||
path('/<slug:name>', HelloNameView.as_view(), name='hello_name'), # '<host:port>/test/<slug:name>' | ||
], # urlpatterns | ||
'test', # app_name | ||
)) | ||
), | ||
] | ||
|
||
|
||
routify_urlpatterns = [ | ||
include_router(router), | ||
# Django Routify url registration with trailing slash | ||
routify_without_trailing_urlpatterns = [ | ||
include_router(routify_without_trailing), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters