Python 如何在Django w/o音译中使用预填充的_字段?
当我在django admin界面中输入名称时,django admin.ModelAdmin中预填充的_字段会自动完成字段标题Python 如何在Django w/o音译中使用预填充的_字段?,python,django,django-admin,Python,Django,Django Admin,当我在django admin界面中输入名称时,django admin.ModelAdmin中预填充的_字段会自动完成字段标题 prepopulated_fields = { 'title': ('name',), } 我怎样才能使相同的功能,但没有音译 例: 想要: 管理员 class Media: js = ('/static/js/jquery.min.js', '/static/js/slug.js') slug.js window.onload
prepopulated_fields = {
'title': ('name',),
}
我怎样才能使相同的功能,但没有音译
例:
想要:
管理员
class Media:
js = ('/static/js/jquery.min.js',
'/static/js/slug.js')
slug.js
window.onload = function() {
document.getElementById("id_name").onkeyup = function() {
var e = document.getElementById("id_title");
if (!e._changed) { e.value = document.getElementById("id_name").value; }
}
}
class Media:
js = ('/static/js/jquery.min.js',
'/static/js/slug.js')
window.onload = function() {
document.getElementById("id_name").onkeyup = function() {
var e = document.getElementById("id_title");
if (!e._changed) { e.value = document.getElementById("id_name").value; }
}
}