Skip to content

Instantly share code, notes, and snippets.

View coredumperror's full-sized avatar

Robert Rollins coredumperror

  • Caltech
  • Azusa, CA
View GitHub Profile
@coredumperror
coredumperror / responsive_image.py
Last active October 17, 2023 15:59 — forked from davecranwell/responsive_image.py
Responsive image tag for Wagtail CMS
from django import template
from wagtail.wagtailimages.models import SourceImageIOError
from wagtail.wagtailimages.templatetags.wagtailimages_tags import ImageNode
register = template.Library()
@register.tag(name="responsiveimage")
def responsiveimage(parser, token):
bits = token.split_contents()[1:]
@coredumperror
coredumperror / test_runner.py
Last active August 4, 2017 00:14
Use file storage on the local filesystem in Django unit tests
import shutil
import tempfile
from django.apps import apps
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.db.models import FileField
from django.db.models.loading import get_model, get_models
from django.test.runner import DiscoverRunner