def _output_embed_to_dir(self, output_dir, version=''): file_name = 'embed{0}.js'.format(version) context = widget.embed_context() rendered = render_to_string( 'widget/{0}'.format(file_name), context) with open(join(output_dir, file_name), 'w') as f: f.write(rendered)
def embed(request, version_no=''): """ This is for serving embed when in development since the compilation with the media url hasn't taken place. Public clients will use the url : SITE_MEDIA/embed.js """ context = widget.embed_context() if bool(version_no) is False: version_no = "" return render_to_response('widget/embed{0}.js'.format(version_no), context, context_instance=RequestContext(request), mimetype='text/javascript')
def embed(request, version_no=''): """ This is for serving embed when in development since the compilation with the media url hasn't taken place. Public clients will use the url : SITE_MEDIA/embed.js """ context = widget.embed_context() if bool(version_no) is False: version_no = "" return render(request, 'widget/embed{0}.js'.format(version_no), context, content_type='text/javascript')
def _output_embed_to_dir(self, output_dir, version=''): file_name = 'embed{0}.js'.format(version) context = widget.embed_context() rendered = render_to_string('widget/{0}'.format(file_name), context) with open(join(output_dir, file_name), 'w') as f: f.write(rendered)