コード例 #1
0
 def post(self, request, *args, **kwargs):
     if not request.user.is_authenticated:
         return HttpResponseForbidden()
     application = Application.objects.get(id=self.get_object().id)
     notification = Notification(
         recipient=application.candidate.user,
         entity_type=Notification.ENTITY_TYPE_APPLICATION_REVIEWED,
         entity_fk_pk=application.id,
     )
     if "accept_button" in self.request.POST:
         application.status = "AC"
         notification.entity_type = Notification.ENTITY_TYPE_APPLICATION_ADVANCED
     elif "reject_button" in self.request.POST:
         application.status = "RE"
         notification.entity_type = Notification.ENTITY_TYPE_APPLICATION_REJECTED
     application.save()
     notification.save()
     return super().post(request, *args, **kwargs)