摘要: 注意点: ajax上传文件,借助FormData对象 同时增加两组键值对 <form action="http://localhost:8081/thingsparse/addorupdthingsparse" method="post" enctype="multipart/form-data"> 阅读全文
posted @ 2018-11-10 12:20 dmyHero 阅读(1128) 评论(0) 推荐(0) 编辑
摘要: # 全局钩子 def clean(self): pwd = self.cleaned_data.get("password") re_pwd = self.cleaned_data.get("re_password") if re_pwd and re_pwd == pwd: return self.clea... 阅读全文
posted @ 2018-11-10 11:58 dmyHero 阅读(327) 评论(0) 推荐(0) 编辑
摘要: // 前端页面实现头像预览 // 当用户选中文件之后,也就是头像的input标签有值时触发 $('#avatar').change(function () { var file = this.files[0]; var fr = new FileReader(); fr.readAsDataURL(file); ... 阅读全文
posted @ 2018-11-10 11:51 dmyHero 阅读(5771) 评论(0) 推荐(1) 编辑