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
headers = { | |
'Cache-Control':'max-age=604800', # 60 x 60 x 24 x 7 = 1 week | |
'Content-Type':content_type, | |
} | |
k = Key(self.get_bucket()) | |
k.key = filename | |
k.set_contents_from_string(contents.getvalue(), headers) | |
if self.public: k.make_public() | |
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
TryMultipleViews.__code__ = TryMultipleViews.__call__.__code__ | |
TryMultipleViews.__closure__ = TryMultipleViews.__call__.__closure__ |
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
egrep 'model_name=".*",' <file> | grep -o '".*"' |sort -u > m.txt | |
sed -i '$!s/$/,/' m.txt | |
pm makemigrations --empty extended_tag --name data_migration_image_fields | |
# Grep thing starting with | |
grep -oP 'name: "\K\w+' cron.yaml |
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
import logging | |
logger = logging.getLogger("mysite.profiling") | |
# mysite/forms/fields/sg_or_image_field.py | |
logger.debug(f"SVG: {repr(self)} - field:{self.field} ") | |
# django/core/files/images.py | |
logger.debug(f"IMG: {repr(file_or_path)} - field:{file_or_path.field} ") |
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
(function(){ | |
var i = document.querySelector('#djdt-flamegraph-iframe'); | |
var tpl = document.querySelector('#djdt-flamegraph-tpl'); | |
i.contentWindow.document.write(tpl.innerHTML); | |
}()) |
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
.moving-pack__header--new { | |
position: absolute; | |
left: 50%; | |
transform: translateX(-50%); | |
} |
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
input.hw-checkbox:checked + label:before { | |
background: #039DE0 url('../../img/tick-white.svg') no-repeat center/80%; | |
border-color: #039DE0; | |
} |
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 django import forms | |
from django.db import models | |
from django.utils.translation import gettext_lazy as _ | |
class RenovationConfirmationContent(models.Model): | |
faq_title = models.CharField(max_length=191) | |
faqCategory = models.ForeignKey("content.faq") | |
def clean(self): | |
if self.faqCategory and not self.faq_title: |
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 django.db import models | |
from django.forms import Textarea | |
class HowToItemInline(admin.StackedInline): | |
# All fields of a particular type | |
formfield_overrides = { | |
models.TextField: {"widget": Textarea(attrs={"rows": 1, "cols": 80})}, | |
} | |
# Specific fields |