alfortville: pass all required criterias when giving avis (#11087)

This commit is contained in:
Frédéric Péters 2016-05-27 10:48:09 +02:00
parent 7c34b60fc3
commit 81b92243c8
1 changed files with 9 additions and 2 deletions

View File

@ -198,8 +198,15 @@ class MailTable(TemplateView):
return context
def post(self, request, *args, **kwargs):
Inbox.objects.filter(source_pk__in=request.POST.getlist('object-pk')).update(done=True,
comments=request.POST.get('comments'))
user_roles = [x.uuid for x in Role.objects.filter(user=self.request.user)]
content_type = ContentType.objects.get_for_model(Mail)
Inbox.objects.filter(
source_type=content_type,
source_pk__in=request.POST.getlist('object-pk'),
role_slug__in=user_roles,
subtype=self.subtype).update(
done=True,
comments=request.POST.get('comments'))
return HttpResponseRedirect('.')