Answered by : yasiel-cabrera
{{ request.path }} # -without GET parameters
{{ request.get_full_path }} # - with GET parameters
Source : | Last Update : Mon, 10 Aug 20
Answered by : mighty-unicorn
{{ request.build_absolute_uri }} #Domain, path and querystring
Source : https://simpleisbetterthancomplex.com/tips/2016/07/20/django-tip-7-how-to-get-the-current-url-within-a-django-template.html | Last Update : Sat, 17 Jul 21
Answered by : laya-godfrey-cleement
from django.urls import path
from . import views
urlpatterns = [ path('', views.index, name='index'),
]
Source : https://docs.djangoproject.com/en/4.0/intro/tutorial01/ | Last Update : Sun, 24 Apr 22
Answered by : anonymous
# 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),
]
Source : https://docs.djangoproject.com/en/3.1/topics/http/urls/ | Last Update : Mon, 16 Nov 20
Answered by : talented-thrush-kniephelq460
{% url 'listing' listing_id=listing.id path=request.get_full_path %}
Source : https://stackoverflow.com/questions/65379988/django-how-to-pass-multiple-parameters-to-url | Last Update : Tue, 16 Nov 21
Answered by : delightful-dormouse-kdy0fyvwua3m
$ pip install django-extensions
Source : https://django-extensions.readthedocs.io/en/latest/index.html | Last Update : Mon, 13 Jun 22