示例#1
0
文件: private.py 项目: silentphp/read
 def form_valid(self, form):
     self.object = form.save()
     if self.object.has_sync:
         attach_webhook(project_pk=self.get_project().pk,
                        user_pk=self.request.user.pk,
                        integration=self.object)
     return HttpResponseRedirect(self.get_success_url())
示例#2
0
文件: private.py 项目: silentphp/read
 def post(self, request, *args, **kwargs):
     # pylint: disable=unused-argument
     if 'integration_pk' in kwargs:
         integration = self.get_integration()
         update_webhook(self.get_project(), integration, request=request)
     else:
         # This is a brute force form of the webhook sync, if a project has a
         # webhook or a remote repository object, the user should be using
         # the per-integration sync instead.
         attach_webhook(
             project_pk=self.get_project().pk,
             user_pk=request.user.pk,
         )
     return HttpResponseRedirect(self.get_success_url())