Code

Ticket #3259: prepopulate.diff

File prepopulate.diff, 669 bytes (added by Gary Wilson <gary.wilson@…>, 7 years ago)

patch is not tested, but uses \w in the regex of characters to exclude. \w is short for [a-zA-Z0-9_].

Line 
1=== modified file 'django/contrib/admin/media/js/urlify.js'
2--- django/contrib/admin/media/js/urlify.js     2006-12-19 04:35:09 +0000
3+++ django/contrib/admin/media/js/urlify.js     2007-01-11 05:48:39 +0000
4@@ -7,7 +7,7 @@
5                   "with"];
6     r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
7     s = s.replace(r, '');
8-    s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
9+    s = s.replace(/[^-\w\s]/g, '');  // remove unneeded chars
10     s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
11     s = s.replace(/[-\s]+/g, '-');   // convert spaces to hyphens
12     s = s.toLowerCase();             // convert to lowercase
13