L
L
Lopus2016-04-20 15:06:26
Django
Lopus, 2016-04-20 15:06:26

How to properly include css, js for inclusion_tag?

For example, there is a newsfeed application with an inclusion_tag that displays a subscription form.
Added class Media with css and js to the form. In the form template, it includes files as expected, everything works: {{ form.media }}
But in the middle of the page, including styles is somehow not very good. I would like to put them in
How is it usually implemented, or maybe my approach is wrong in general? I thought it was possible somehow through takes_context = True, but I didn’t think of how

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-04-21
@sim3x

Make a separate template and include styles in the right place
Use class Media as a last resort

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question