def unsubscribe(request, watch_id):
 try:
  watch = Watch.objects.get(pk=watch_id)
  secret = request.GET.get('s')
  if (secret != watch.secret):
   raise Watch.DoesNotExist
 except Watch.DoesNotExist:
  return render(request, 'motidings/unsubscribe_error.html')
 if (request.method == 'POST'):
  watch.delete()
  return render(request, 'motidings/unsubscribe_success.html')
 return render(request, 'motidings/unsub.html', {'watch': watch})

def unsubscribe ( request , watch_id ) : try : watch = Watch . objects . get ( pk = watch_id ) secret = request . GET . get ( 's' ) if ( secret != watch . secret ) : raise Watch . DoesNotExist except Watch . DoesNotExist : return render ( request , 'motidings/unsubscribe_error.html' ) if ( request . method == 'POST' ) : watch . delete ( ) return render ( request , 'motidings/unsubscribe_success.html' ) return render ( request , 'motidings/unsub.html' , { 'watch' : watch } )
unsubscribe a query .