Yes and no. Instead of the immune system mistaking some stray peanut as a poison (as happens with peanut allergy), the immune system thinks insulin, being produced internally by pancreatic cells, is poison. Both involve a misguided war launched by the immune system, the end game being anaphylaxis in peanut allergy and destroyed pancreatic cells in diabetes.
So, so interesting that they might both be prevented in the same way: oral introduction of the offending substance at a pre-disease stage. It's is considered a type of immunisation (see previous post), only the dosing may need to be continued regularly to keep the disease from developing. In both cases, doctors are trying to educate the immune system, teaching it safe from sorry.