This commit is contained in:
virusdefender 2015-08-19 08:21:25 +08:00
parent 46321e4249
commit c98abddfee

View File

@ -36,7 +36,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
groups = Group.objects.filter(id__in=data["groups"])
else:
groups = Group.objects.filter(id__in=data["groups"], admin=request.user)
groups = Group.objects.filter(id__in=data["groups"], created_by=request.user)
if not groups.count():
return error_response(u"至少选择一个小组")
else:
@ -68,7 +68,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
announcement = Announcement.objects.get(id=data["id"])
else:
announcement = Announcement.objects.get(id=data["id"], admin=request.user)
announcement = Announcement.objects.get(id=data["id"], created_by=request.user)
except Announcement.DoesNotExist:
return error_response(u"公告不存在")
groups = []
@ -76,7 +76,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
groups = Group.objects.filter(id__in=data["groups"])
else:
groups = Group.objects.filter(id__in=data["groups"], admin=request.user)
groups = Group.objects.filter(id__in=data["groups"], created_by=request.user)
if not groups.count():
return error_response(u"至少选择一个小组")
announcement.title = data["title"]
@ -101,7 +101,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
announcement = Announcement.objects.all().order_by("-last_update_time")
else:
announcement = Announcement.objects.filter(admin=request.user)
announcement = Announcement.objects.filter(created_by=request.user)
visible = request.GET.get("visible", None)
if visible:
announcement = announcement.filter(visible=(visible == "true"))