fix media admin change
This commit is contained in:
parent
2ac0809e79
commit
14369170c6
|
@ -356,8 +356,8 @@ def media_admin_change(request):
|
|||
else:
|
||||
if UserModel.objects.filter(username=phone).exists():
|
||||
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
|
||||
obj = UserModel.objects.get_or_create(
|
||||
username=phone)
|
||||
obj = UserModel.objects.create(
|
||||
username=phone, last_login=datetime.now())
|
||||
p = Userprofile.objects.create(
|
||||
user=obj, name=name, organization=o, admin_status=1)
|
||||
profile.admin_status = 4
|
||||
|
@ -394,10 +394,10 @@ def media_admin_add(request):
|
|||
UserModel = get_user_model()
|
||||
|
||||
if o.is_direct(): # 如果是省直
|
||||
obj, created = UserModel.objects.get_or_create(
|
||||
username=phone)
|
||||
if not created:
|
||||
if UserModel.objects.filter(username=phone).exists():
|
||||
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
|
||||
obj = UserModel.objects.create(
|
||||
username=phone, last_login=datetime.now())
|
||||
p = Userprofile.objects.create(
|
||||
user=obj, name=name, organization=o, admin_status=2)
|
||||
managers = Userprofile.level1_admin()
|
||||
|
@ -410,10 +410,10 @@ def media_admin_add(request):
|
|||
send_tnps(phones, '审核', content)
|
||||
return JsonResponse({'status': 'success', 'message': {'title': o.name, 'organizationId': o.id}})
|
||||
else:
|
||||
obj, created = UserModel.objects.get_or_create(
|
||||
username=phone, last_login=datetime.now())
|
||||
if not created:
|
||||
if UserModel.objects.filter(username=phone).exists():
|
||||
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
|
||||
obj = UserModel.objects.create(
|
||||
username=phone, last_login=datetime.now())
|
||||
p = Userprofile.objects.create(
|
||||
user=obj, name=name, organization=o, admin_status=1)
|
||||
managers = Userprofile.level2_admin(o.cities)
|
||||
|
|
Loading…
Reference in New Issue