how to get the current url path in django template
{{ request.path }} # -without GET parameters
{{ request.get_full_path }} # - with GET parameters
how to get the current url path in django template
{{ request.path }} # -without GET parameters
{{ request.get_full_path }} # - with GET parameters
django get parameters from url
message = request.GET.get('message')
django slug int url mapping
# in views define the int slugs then the url mapping is like this
from django.urls import path, re_path
from . import views
urlpatterns = [
path('articles/2003/', views.special_case_2003),
re_path(r'^articles/(?P<year>[0-9]{4})/$', views.year_archive),
re_path(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', views.month_archive),
re_path(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<slug>[w-]+)/$', views.article_detail),
]
Standard Django URL
from django.urls import path
from . import views, tests
#####/////////////////// AUDITION URLS ///////////////////#####
urlpatterns = [
##-------------------------------VIEWS-------------------------------##
path('view/index', views.audition_view_index, name='audition_view_index'),
path('view/create', views.audition_view_create, name='audition_view_create'),
path('view/edit/<int:id>', views.audition_view_edit, name='audition_view_edit'),
path('view/details/<int:id>', views.audition_view_details, name='audition_view_details'),
##-------------------------------PROCESSES-------------------------------##
path('process/create', views.audition_process_create, name='audition_process_create'),
path('process/edit/<int:id>', views.audition_process_edit, name='audition_process_edit'),
path('process/delete/<int:id>', views.audition_process_delete, name='audition_process_delete'),
##-------------------------------SFX-------------------------------##
##-------------------------------TEST-------------------------------##
path('test', views.test, name='test'),
]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us