Skip to content

Commit feb2040

Browse files
authored
1 parent bc3e147 commit feb2040

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

readthedocs/oauth/tasks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ def attach_webhook(project_pk, user_pk, integration=None):
5353
connections -- that is, projects that do not have a remote repository them
5454
and were not set up with a VCS provider.
5555
"""
56-
project = Project.objects.get(pk=project_pk)
57-
user = User.objects.get(pk=user_pk)
56+
project = Project.objects.filter(pk=project_pk).first()
57+
user = User.objects.filter(pk=user_pk).first()
58+
59+
if not project or not user:
60+
return False
61+
5862
project_notification = InvalidProjectWebhookNotification(
5963
context_object=project,
6064
user=user,

0 commit comments

Comments
 (0)