提交单选框、时间格式出错
来源:13-4 自定义列表返回数据,同一个model注册两个管理器
桂圆
2018-12-23
老师,我在前端提交日期格式的时候,出错,返回信息个人资料修改失败。如果在form表单中把属性是日期的birthday字段去掉,就不会出问题,请问这是怎么回事呢
class UserView(View):
def get(self, request):
user = request.user
return render(request, 'employee.html', {'user': user})
def post(self, request):
user = request.user
user_profile = get_object_or_404(Employee, user=user)
user_form = UploadImageForm(request.POST)
if user_form.is_valid():
user_profile.name = user_form.cleaned_data['name']
user_profile.birthday = user_form.cleaned_data['birthday']
user_profile.moblie = user_form.cleaned_data['moblie']
user_profile.email = user_form.cleaned_data['email']
user_profile.save()
return HttpResponseRedirect(reverse('users:employee'))
else:
return HttpResponse('{"status":"fail", "msg":"个人资料修改失败"}', content_type='application/json')
写回答
1回答
-
出错的错误栈截图我看看呢
122018-12-26
相似问题