针对添加学号字段对页面的一些修改,注册是学校为青岛大学则显示学号字段,在user settings页面显示学号,并提供修改

This commit is contained in:
sxw
2015-12-08 14:33:40 +08:00
parent 7d358c9e4c
commit 2d6be12a2f
6 changed files with 34 additions and 7 deletions

View File

@@ -97,7 +97,7 @@ class UserRegisterAPIView(APIView):
email=data["email"])
user.set_password(data["password"])
user.save()
UserProfile.objects.create(user=user, school=data["school"])
UserProfile.objects.create(user=user, school=data["school"], student_id=data["student_id"])
return success_response(u"注册成功!")
else:
return serializer_invalid_response(serializer)
@@ -262,6 +262,7 @@ class UserProfileAPIView(APIView):
user_profile.codeforces_username = data["codeforces_username"]
user_profile.blog = data["blog"]
user_profile.school = data["school"]
user_profile.student_id = data["student_id"]
user_profile.phone_number = data["phone_number"]
user_profile.save()
return success_response(u"修改成功")