1.继续完成filetypechange !
Leon 版本的view_property,和他比较我的版本差别在哪里
#如果是日本的类型,首先通过后面的方式获得file_type_origin,??
#如果是这两个类型的['FLP','MAP'],file_type和file_type_subpart需要特殊处理下?
leon 的解答只是为了实现了逻辑上的顺畅,即使现在没有任何的区别,如果以后修改就可以很快了!
这边还有一个问题,利用form 形式传过来request.POST['property_form_type_choice'],是怎么得到对应的值???
request.POST['property_form_type_choice']`
if form_setting.form_sets == policy_jp_ind:
file_type_origin= request.POST['property_form_type_choice']
if views.containsAnyFromList(file_type_origin, ['FLP','MAP']):
file_type = file_type_origin[-3:]
file_type_subpart = file_type_origin[0]
else:
file_type = file_type_origin
file_type_subpart = ''
else:
file_type = request.POST['property_form_type_choices']
file_type_subpart = ''
file_instance = get_object_or_404(PropertyFile,pk=int(file_id),RecordEndDate="NULL")
#我的版本为什么不通过我的形式得到东西呢?问一下leon
#document_1=PropertyFile.objects.filter(Q(Property=property_instance)&Q(RecordEndDate='NULL')).first()
file_instance.Property_File_Type = file_type
file_instance.Property_File_Type_Subpart = file_type_subpart
file_instance.save()
property_instance = file_instance.Property
documents_2 = PropertyFile.objects.filter(Q(Property=property_instance)& Q(RecordEndDate="NULL"))
file_type_filter = ['PRF','FLP','PHO','MAP']
form_1 = UploadFileFormChoice()
return render_to_response(ui_sets['search_property_files'],{'documents':documents_2,'file_type_filter':file_type_filter,'form_1':form_1},context_instance = RequestContext(request))
2.之前是通过form形式拿到后台对应的数值,但是现在是get的方式,怎么取到这个值??file_type_origin = request.POST['property_form_type_choice']
直接拿啊!!在select选项里面,取value的
3.出现的问题是修改一个,就会少一个??
因为:问题出现在view语句中我把下拉框的值输出值搞错了,所以输入的 file_type_origin = a_origin不满足三个字的格式,所以会出现这样子的问题
4.print 出来的东西会抱错oercing to Unicode: need string or buffer, long found
5.前端的js 不工作,不知道什么原因,错误代码在下面,感觉是没有工作
不知道是什么原因??
selected 不能被正确选择的原因
因为select 被包裹在
<script type="text/javascript">
setTimeout(function() {
var field_id = "id_" + "{{ field.html_name }}";
var a = document.getElementById(field_id);
a.setAttribute("class","form-control");
a.setAttribute("display","inline");
}, 100);
function goclick2(){
var e = document.getElementById("id_property_form_type_choice");
var strUser = e.options[e.selectedIndex].value;
alert(strUser);
var link= document.getElementById("abc");
var url = "/property/change_filetype/{{ document_item.id }}/?a="+strUser
url = encodeURI(url);
link.setAttribute('href',url);
window.location.href=url;
};
</script>
6.出现’ TemplateDoesNotExist at /’突然出现的,不知道为什么。。。
显示错误的位置在context_instance = RequestContext(request))
真的不知道为什么
控制台的错误信息是下面的形式,但是我什么都没有做,
解决的方式是:一不小心删除了base.html文件导致找不到对应的template !
raise TemplateDoesNotExist(template_name, chain=chain)
TemplateDoesNotExist: #.html
js 嵌套函数的调用,使用到js 函数中的函数
使用方式:
function outer() {
function inner() {
alert("hi");
}
inner();
}
或者是这样的方式
function outer() {
this.inner = function() {
alert("hi");
}
}
<input type="button" onclick="(new outer()).inner();" value="ACTION">