add rank for organization

This commit is contained in:
baoliang 2021-05-11 17:45:46 +08:00
parent 14369170c6
commit 9aa50cf38e
4 changed files with 2 additions and 1 deletions

View File

@ -147,6 +147,7 @@ class Organization(models.Model):
created = models.DateTimeField('创建时间', auto_now_add=True) created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True) updated = models.DateTimeField('更新时间', auto_now=True)
admin_status = models.IntegerField('管理状态', default=3) admin_status = models.IntegerField('管理状态', default=3)
# rank = models.IntegerField('排名', default=1)
class Meta: class Meta:
ordering = ["name"] ordering = ["name"]

View File

@ -131,7 +131,6 @@ def delete_organization(request):
o = Organization.objects.get(id=id) o = Organization.objects.get(id=id)
count1 = NewMedia.count(o.id) count1 = NewMedia.count(o.id)
count2 = Userprofile.count(o.id) count2 = Userprofile.count(o.id)
print(count1, count2)
if count1 != 0 or count2 != 0: if count1 != 0 or count2 != 0:
return JsonResponse({'status': 'error', 'message': '机构下有新媒体或管理未注销,无法删除'}) return JsonResponse({'status': 'error', 'message': '机构下有新媒体或管理未注销,无法删除'})
if o.is_direct(): if o.is_direct():
@ -147,6 +146,7 @@ def delete_organization(request):
send_tnps(phones, '审核', content) send_tnps(phones, '审核', content)
else: else:
o.admin_status = 4 o.admin_status = 4
o.save()
admins = Userprofile.level2_admin(o.cities) admins = Userprofile.level2_admin(o.cities)
content = '%s注销了机构,请审核' % (profile,) content = '%s注销了机构,请审核' % (profile,)
phones = [] phones = []