Skip to content

Commit

Permalink
Fixed #729 -- prepopulate_from (urlify.js) now removes characters tha…
Browse files Browse the repository at this point in the history
…t aren't a-z, 0-9 or spaces

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1097 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Nov 6, 2005
1 parent 7e28ba0 commit b14a50b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django/contrib/admin/media/js/urlify.js
Expand Up @@ -7,7 +7,7 @@ function URLify(s, num_chars) {
"with"]; "with"];
r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi'); r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
s = s.replace(r, ''); s = s.replace(r, '');
s = s.replace(/[^\w\s-]/g, ''); // remove unneeded chars s = s.replace(/[^-A-Z0-9\s]/gi, ''); // remove unneeded chars
s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
s = s.replace(/\s+/g, '-'); // convert spaces to hyphens s = s.replace(/\s+/g, '-'); // convert spaces to hyphens
s = s.toLowerCase(); // convert to lowercase s = s.toLowerCase(); // convert to lowercase
Expand Down

0 comments on commit b14a50b

Please sign in to comment.