Django: Is it possible to attach media files (css, javascript etc) to a View-class?
- by mrmclovin
I can't fins any information on how to define css or javascript files in a view like:
class MyView(View):
....
class Media:
css = { 'all' : 'mystyle.css' }
If you have a form you can do like:
class MyForm(ModelForm):
....
class Media:
css = { 'all' : 'mystyle.css' }
And then in the template you can print the files like;
{{ form.media.css }}
I like that Syntax very much and I like to keep the View-specific css files in the app-directory.
Does anyone know if it's possible?
Thanks!