This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from django.utils.encoding import smart_str | |
import uwsgi | |
def uwsgi_cachekey(key): | |
return 'django_compressor%s.%s' % (uwsgi.started_on, smart_str(key)) | |
except ImportError: | |
pass | |
COMPRESS_CACHEABLE_PRECOMPILERS = ('text/x-scss', ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from StringIO import StringIO | |
from django.core.serializers.json import Serializer as JSONSerializer | |
class ImageSpecFieldsJSONSerializer(JSONSerializer): | |
""" | |
Adds ImageSpecFields to the serialization | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if settings.DEBUG: | |
urlpatterns = urlpatterns + patterns('', | |
(r'^404/$', TemplateView.as_view(template_name='404.html')), | |
(r'^500/$', TemplateView.as_view(template_name='500.html')), | |
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', { | |
'document_root': settings.STATIC_ROOT, | |
}), | |
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { | |
'document_root': settings.MEDIA_ROOT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# New FormSet Mixin | |
def construct_formsets(self, **kwargs): | |
prefixes = {} | |
object = getattr(self, 'object', None) | |
for FormSet, inline in zip(self.admin_opts.get_formsets( | |
self.request, object), self.inline_instances): | |
prefix = FormSet.get_default_prefix() | |
prefixes[prefix] = prefixes.get(prefix, 0) + 1 |