what is reverse() in Django

前端 未结 7 1574
Happy的楠姐
Happy的楠姐 2020-11-30 16:40

When I read django code sometimes, I see in some templates reverse(). I am not quite sure what this is but it is used together with HttpResponseRedirect. How an

7条回答
  •  自闭症患者
    2020-11-30 17:03

    The reverse() is used to adhere the django DRY principle i.e if you change the url in future then you can reference that url using reverse(urlname).

提交回复
热议问题