What is the difference between path() and re_path()?
Asked Answered
W

1

10

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?

Whether answered 28/5, 2018 at 15:39 Comment(0)
Q
12

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).

Quin answered 28/5, 2018 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.