Actually, the best sample code available would be the admin page itself. You can bring up that page in your browser to see the JavaScript being used, and then look at the views in django.contrib.admin to see how it’s handled on the server.
Also see Form Assets (the Media class) | Django documentation | Django for some breadcrumbs as to how to use those admin widgets in your own page.