What I'm trying to do is use a SIMILE timeline in my Django app. The timeline requires it's data in an XML file. Now, I know how to render a view in html. And I can probably figure out how to render a view into XML. But how would one render both, then pull in the XML data to the HTML file if the XML file doesn't exist on disk (since it is being generated by Django)?
Thanks!
Edit: The line that takes the XML is in Javascript, and looks like this:
Timeline.loadXML("/static/example1.xml", function(xml,url) {eventSource.loadXML(xml,url); })
I need a path, since inserting the XML directly as a string doesn't work. But no path exists, since the XML file never actually exists on disk.
You seem to be trying to cram too many things into the same view.
What I'd do is the following:
@cache_page(60 * 60)
If, for some reason, you need the XML at the time of generation of the HTML (as you seem to indicate in your title), you can just directly call your XML view from the HTML one. E.g.:
@cache_page(..)
def xml(request):
# ... generate xml
def html(request):
xml = xml(request)
# ... generate timeline from xml
Of course, there's nothing stopping you from manually caching to disk but it's easier to just use Django's facilities.