From b3688e81943d6d059d3f3c95095498a5aab84852 Mon Sep 17 00:00:00 2001
From: Malcolm Tredinnick <malcolm.tredinnick@gmail.com>
Date: Sat, 23 Aug 2008 22:10:45 +0000
Subject: [PATCH] Fixed #7903 -- Allow admin's prepopulated_from to work with
 TextFields. Patch from mk and Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 .../contrib/admin/templates/admin/prepopulated_fields_js.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/django/contrib/admin/templates/admin/prepopulated_fields_js.html b/django/contrib/admin/templates/admin/prepopulated_fields_js.html
index 9e78c34b35..e1cdb9614e 100644
--- a/django/contrib/admin/templates/admin/prepopulated_fields_js.html
+++ b/django/contrib/admin/templates/admin/prepopulated_fields_js.html
@@ -4,8 +4,8 @@
     {% for dependency in field.dependencies %}
     document.getElementById("{{ dependency.auto_id }}").onkeyup = function() {
         var e = document.getElementById("{{ field.field.auto_id }}");
-        if (!e._changed) { e.value = URLify({% for innerdep in field.dependencies %}document.getElementById("{{ innerdep.auto_id }}").value{% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length }}); }
+        if (!e._changed) { e.value = URLify({% for innerdep in field.dependencies %}document.getElementById("{{ innerdep.auto_id }}").value{% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length|default_if_none:"50" }}); }
     }
     {% endfor %}
 {% endfor %}
-</script>
\ No newline at end of file
+</script>