fix manager change bug

This commit is contained in:
baoliang 2021-04-29 21:57:14 +08:00
parent bfe9ad0fba
commit f12fe00766
2 changed files with 10 additions and 16 deletions

View File

@ -329,14 +329,11 @@ def media_admin_change(request):
if o.is_direct(): # 如果是省直
obj, created = UserModel.objects.get_or_create(
username=phone, last_login=datetime.now())
if created:
p = Userprofile.objects.create(
user=obj, name=name, organization=o, admin_status=2)
else:
p = Userprofile.objects.filter(user=obj).first()
p.admin_status = 2
p.save()
username=phone)
if not created:
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
p = Userprofile.objects.create(
user=obj, name=name, organization=o, admin_status=2)
profile.admin_status = 5
profile.save()
managers = Userprofile.level1_admin()
@ -350,14 +347,11 @@ def media_admin_change(request):
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 created:
p = Userprofile.objects.create(
user=obj, name=name, organization=o, admin_status=1)
else:
p = Userprofile.objects.filter(user=obj).first()
p.admin_status = 2
p.save()
username=phone)
if not created:
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
p = Userprofile.objects.create(
user=obj, name=name, organization=o, admin_status=1)
profile.admin_status = 4
profile.save()
managers = Userprofile.level2_admin(o.cities)