Home > Net >  Django multiple params link
Django multiple params link

Time:08-09

I have this urls.py

path('calendar/<dt:date>/', views.CertainDay.as_view(), name="classrooms"),
path('calendar/<dt:date>/<int:classroom>/', views.ScheduleList.as_view(), name="schedule"),

first path with one args works good with reverse func in some file

how i can do this -> from .../calendar/2020-01-01 to .../calendar/2020-01-01/100 in template without using context and 2 args like url " " date arg2

something like <a href = "{% url 'schedule' *** %}> tries reverse full path with two args

CodePudding user response:

If you are on URL www.website.com/calendar/2020-01-01/ and you want to go on www.website.com/calendar/2020-01-01/100/, you can have a relative link like this :

<a href="100/">Go to 100</a>

No need to use the template function {% url 'schedule' *** %} but this is not the cleaner solution since it is harder to debug.

  • Related