Skip to content

Commit fab1b12

Browse files
authored
Merge pull request learningequality#5769 from ashnaaseth2325-oss/fix/channel-does-not-exist-remove-self
fix: handle Channel.DoesNotExist in remove_self
2 parents 8badfd7 + f44919b commit fab1b12

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • contentcuration/contentcuration/viewsets

contentcuration/contentcuration/viewsets/user.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ def remove_self(self, request, pk=None):
312312
if not channel_id:
313313
return HttpResponseBadRequest("Channel ID is required.")
314314

315-
channel = Channel.objects.get(id=channel_id)
316-
if not channel:
315+
try:
316+
channel = Channel.objects.get(id=channel_id)
317+
except Channel.DoesNotExist:
317318
return HttpResponseNotFound("Channel not found {}".format(channel_id))
318319

319320
if request.user != user and not request.user.can_edit(channel_id):

0 commit comments

Comments
 (0)