fix manager change bug
This commit is contained in:
parent
bfe9ad0fba
commit
f12fe00766
Binary file not shown.
|
@ -329,14 +329,11 @@ def media_admin_change(request):
|
||||||
|
|
||||||
if o.is_direct(): # 如果是省直
|
if o.is_direct(): # 如果是省直
|
||||||
obj, created = UserModel.objects.get_or_create(
|
obj, created = UserModel.objects.get_or_create(
|
||||||
username=phone, last_login=datetime.now())
|
username=phone)
|
||||||
if created:
|
if not created:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
|
||||||
p = Userprofile.objects.create(
|
p = Userprofile.objects.create(
|
||||||
user=obj, name=name, organization=o, admin_status=2)
|
user=obj, name=name, organization=o, admin_status=2)
|
||||||
else:
|
|
||||||
p = Userprofile.objects.filter(user=obj).first()
|
|
||||||
p.admin_status = 2
|
|
||||||
p.save()
|
|
||||||
profile.admin_status = 5
|
profile.admin_status = 5
|
||||||
profile.save()
|
profile.save()
|
||||||
managers = Userprofile.level1_admin()
|
managers = Userprofile.level1_admin()
|
||||||
|
@ -350,14 +347,11 @@ def media_admin_change(request):
|
||||||
return JsonResponse({'status': 'success', 'message': {'title': o.name, 'organizationId': o.id}})
|
return JsonResponse({'status': 'success', 'message': {'title': o.name, 'organizationId': o.id}})
|
||||||
else:
|
else:
|
||||||
obj, created = UserModel.objects.get_or_create(
|
obj, created = UserModel.objects.get_or_create(
|
||||||
username=phone, last_login=datetime.now())
|
username=phone)
|
||||||
if created:
|
if not created:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '手机号已存在'})
|
||||||
p = Userprofile.objects.create(
|
p = Userprofile.objects.create(
|
||||||
user=obj, name=name, organization=o, admin_status=1)
|
user=obj, name=name, organization=o, admin_status=1)
|
||||||
else:
|
|
||||||
p = Userprofile.objects.filter(user=obj).first()
|
|
||||||
p.admin_status = 2
|
|
||||||
p.save()
|
|
||||||
profile.admin_status = 4
|
profile.admin_status = 4
|
||||||
profile.save()
|
profile.save()
|
||||||
managers = Userprofile.level2_admin(o.cities)
|
managers = Userprofile.level2_admin(o.cities)
|
||||||
|
|
Loading…
Reference in New Issue