This file contains hidden or 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.http import HttpResponse | |
class AllowCORSMixin(object): | |
def add_access_control_headers(self, response): | |
response["Access-Control-Allow-Origin"] = "*" | |
response["Access-Control-Allow-Methods"] = "GET, OPTIONS" | |
response["Access-Control-Max-Age"] = "1000" | |
response["Access-Control-Allow-Headers"] = "X-Requested-With, Content-Type" |
This file contains hidden or 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 smtpd | |
import asyncore | |
import logging | |
import email | |
from email.header import decode_header | |
import requests | |
logger = logging.getLogger(__name__) | |
class CustomSMTPServer(smtpd.SMTPServer): |
This file contains hidden or 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
# coding=utf-8 | |
from __future__ import unicode_literals | |
import logging | |
from django.core.management.base import BaseCommand, CommandError | |
from django.apps import apps | |
from xlsxwriter.workbook import Workbook | |
logger = logging.getLogger(__name__) |
This file contains hidden or 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 | |
from os.path import exists | |
from os import remove, getpid | |
from django.core.management.base import BaseCommand | |
logger = logging.getLogger(__name__) | |
class LockedCommand(BaseCommand): | |
""" |
This file contains hidden or 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
""" | |
Dump out objects and all nested associations. | |
""" | |
import sys | |
from django.apps import apps | |
from django.contrib.admin.utils import NestedObjects | |
from django.core import serializers | |
from django.core.management import BaseCommand | |
from django.db import router |
OlderNewer