Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between path() and re_path()?

In Django2.0 were introduced path() and re_path().

But the difference between boths is unclear to me : is it about the ability to use or not regexps with it?

Would that mean that I couldn't use both <type:name> and (?P<name>\d+) syntaxes in the same pattern?

like image 895
vmonteco Avatar asked May 28 '18 15:05

vmonteco


1 Answers

For my understanding is that the path function does not accept regex urls anymore, you need to use the new urls syntax <slug:title> instead of passing a regex to match parameters. The re_path only work with regex formatted urls (The old way we make urls).

like image 65
Luan Fonseca Avatar answered Oct 18 '22 03:10

Luan Fonseca