I want to move some parts of a main template into partials which shall not need django rendering (i.e. pure html/js) and use them in a ng-view in the main template.
However, the partials have Django formsets (using crispy) in them i.e useless without Django rendering.
Moreover, I do not want to write the complete formset HTML by hand.
How can I do this?
Maybe you have a less or sass file too. This file, like your form, it's unusable without preprocessing.
Review code from https://www.djangopackages.com/grids/g/asset-managers/ for inspiration and look at https://docs.djangoproject.com/en/dev/howto/static-files/ to learn how to do it.
Hard part is not do it because its easy make a static finder. Hard part is do it in development staging in a transparent way.
You can request your partials from the server and put them into the $templateCache yourself using the filename as a key.
This way, when a partial .hmtl file is request, it will get the django rendered HTML.
$http.get('myForm.html', {cache:$templateCache});
You'll want to eagerly load these partial templates, as if the partial template is not in the cache, then it'll request the static html.
Hope this helps
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