Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

裁剪图片的ajax不能提交 #14

Open
TQCAI opened this issue Mar 2, 2019 · 3 comments
Open

裁剪图片的ajax不能提交 #14

TQCAI opened this issue Mar 2, 2019 · 3 comments

Comments

@TQCAI
Copy link

TQCAI commented Mar 2, 2019

<script type="text/javascript" src= "{% static 'js/csrf.js'%}"></script>

	$('#btnCrop').on('click', function(){
		//alert("图片上传喽");
            $.ajax({
                url: '{% url "account:my_image" %}',
                type: 'POST',
                data: {"img": img},
                success: function(e){
                    location.href= "{% url 'account:my_information' %}" },

                
                });
	});

按照教程, 但是点击OK后仍然不能提交

@TQCAI
Copy link
Author

TQCAI commented Mar 2, 2019

<script type="text/javascript" src= "{% static 'js/csrf.js'%}"></script>
	$('#btnCrop').on('click', function(){
		//alert("图片上传喽");
            $.ajax({
                url: '{% url "account:my_image" %}',
                type: 'POST',
                data: {"img": img},
                success: function(e){
                    location.href= "{% url 'account:my_information' %}" },

                
                });
	});

按照教程, 但是点击OK后仍然不能提交

我已经解决了, 因为默认的photo属性长度限制的问题
在account/model.py中
photo=models.ImageField(blank=True,max_length=10000)
解决

@qiwsir
Copy link
Owner

qiwsir commented Mar 4, 2019 via email

@yudukanghe
Copy link

但是我设置了15000,终端没报错,但显示的头像都只是一小部分不能全部显示,是什么原因?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants