![](https://static.mrcoffee.io/media/cache/4c/1b/4c1b73bfef2d5573e51fd6aed96a4790.jpg)
Custom code editor in Django admin
Example in this post will demonstrate how to add CodeMirror, a text editor implemented in Javascript, to the Django Textarea form widget by extending the class django.forms.Textarea
. Modified widget will be used as an example in Django Admin, but it can be easily ported to any Django form. CodeMirror editor implemented below is set to a HTML/Javascript mode. To support other languages/modes check the CodeMirror documentation.