How to include plug-n-play widget statics [CSS/JS] without repetition?
Depending on your use case a few options:

Use a separate base template for all pages that need the widget; in that base add the required js/css files.  For all views that need the widget, inherit from the modified base.
Using javascript implement conditional includes.
I have a reusable google-maps widget that can be plugged into any page that might want to use it.
Widget has :

Google maps specific js includes.
Map specific css to style the map.

Problem:

Widget code gets included as server-side include.
Widget specific js and css has to included with the widget code.
Therefore, if widget repeats 5 times on a page, then the include statements for js and css get included 5 times.
I can-not keep the widget specific includes in the <head> tag, since if the widget is not used on the page, then un-used js and css gets downloaded on client.

So, how should I keep the js and css so they gets included only when the widget is used and no multiple include are done in case the widget is repeated.
My technology:

Django-Python [ If that matters ]
I also faced the same problem on php

Note :

I understand that including the same js and css multiple times on a page doesn't forces the client to download them multiple times, but I want to avoid the multiple includes.

How should I tackle this problem ?
Please feel free to ask for more info, if I missed something. :)