I have simple question here. I know how to use django media in order to put js and css files which is specified in media class like this:
In forms.py for model
from django import forms
class CalendarWidget(forms.TextInput):
class Media:
css = {
'all': ('pretty.css',)
}
js = ('animations.js', 'actions.js')
In template file
{{ form.media }}
However I want to put separately JS and CSS. It means I want to put CSS at head section and JS before body tag. So how I can achieve it using build in tags? Is it possible?
P.S. I cannot find out information from django documentation. (Perhaps, I look in wrong place). So give me a hint.
You can use {{form.media.css}}
and {{form.media.js}}
separately to put them at required places.
Reference docs subsets-of-assets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With