mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.10.x] Clarified URL regex check message with respect to include().
Backport of 7ed8b98f42 from master
This commit is contained in:
committed by
Tim Graham
parent
0a81f540c9
commit
51e5ca4462
@@ -97,8 +97,11 @@ def check_pattern_startswith_slash(pattern):
|
||||
regex_pattern = pattern.regex.pattern
|
||||
if regex_pattern.startswith('/') or regex_pattern.startswith('^/'):
|
||||
warning = Warning(
|
||||
"Your URL pattern {} has a regex beginning with a '/'. "
|
||||
"Remove this slash as it is unnecessary.".format(describe_pattern(pattern)),
|
||||
"Your URL pattern {} has a regex beginning with a '/'. Remove this "
|
||||
"slash as it is unnecessary. If this pattern is targeted in an "
|
||||
"include(), ensure the include() pattern has a trailing '/'.".format(
|
||||
describe_pattern(pattern)
|
||||
),
|
||||
id="urls.W002",
|
||||
)
|
||||
return [warning]
|
||||
|
||||
Reference in New Issue
Block a user