Skip to content

Instantly share code, notes, and snippets.

@leonardoo
Created July 14, 2015 06:26
Show Gist options
  • Save leonardoo/1efe80ce868198dda2ea to your computer and use it in GitHub Desktop.
Save leonardoo/1efe80ce868198dda2ea to your computer and use it in GitHub Desktop.
import os
from django.conf import settings
from django.shortcuts import render
from django.test.utils import override_settings
@override_settings(STATIC_URL="{}/".format(os.path.abspath(settings.STATIC_ROOT)))
def html_for_print(request, context_object_name, instance, template):
data = {context_object_name: instance}
return render(request, template, data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment