def handle(self, *args, **options): path = self._get_path(**options) if not os.path.exists(path): raise CommandError('Path "%s" does not exist' % path ) outfile = open(os.path.join(path,'jsurls.js'),'w') template = get_template('jsurls/jsurl_list.html') print template outfile.write( template.render( Context( {'named_urls': get_named_urls()} ))) outfile.close() self.stdout.write('Successfully wrote file to "%s"\n' % os.path.join(path,'jsurls.js'))
def jsurl_list(request): return render_to_response( 'jsurls/jsurl_list.html', {'named_urls': get_named_urls()}, mimetype="application/javascript")