The method that I just discovered is to just simulate the entire
request process. This doesn't solve your issue of the template tags,
but at least it gives you some way of getting at the generated data.
You need to manually generate the Resource for your handler inside of
whatever view your are rendering your Backbone.js bootstrapping code.
## in your view (this assume you have imported
## piston's Resource and your HatHandler)
def view_func(self, request, ...)
# ...
# your regular view code
# ...
hat_handler = Resource(HatHandler)
response = hat_handler(request)
context['hat_collection'] = response.content
# ...
# then the rest of your view code that renders the template
# ...
## Then in your template
<script>HatCollection.refresh({{ hat_collection }}); </script>
What's important to note is that piston will generate it's json
response with a request that may not have the intended request
parameters you would normally have (like say a specified Hat id), so
this doesn't work for all situations. To solve that would require
modifying the request object to add certain parameters, which should
be doable.
--
You received this message because you are subscribed to the Google Groups "django-piston" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-pisto...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-piston?hl=en.