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 cStringIO import StringIO | |
| from django.utils import unittest | |
| from django.core.files.uploadedfile import InMemoryUploadedFile | |
| from django.test.client import Client | |
| class BaseTest(unittest.TestCase): | |
| def _delete_objects(self): | |
| models = getattr(self, 'models', []) |
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 | |
| from django.template.loaders.app_directories import app_template_dirs | |
| from django.template import TemplateDoesNotExist, RequestContext | |
| from django.core import urlresolvers | |
| from django.conf import settings | |
| from jinja2 import Environment, FileSystemLoader, TemplateNotFound | |
| class View(object): |
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
| #!/usr/bin/env python | |
| import subprocess | |
| import time | |
| import shlex | |
| import re | |
| percent = 100 |
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.core.management.base import BaseCommand | |
| class Command(BaseCommand): | |
| def handle(self, *args, **options): | |
| if len(args) > 0: | |
| for arg in args: | |
| try: | |
| globals()[arg]() |
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 sys | |
| from decimal import * | |
| LT_27 = True if sys.version_info < (2, 7) else False | |
| def f2d(f): | |
| """ | |
| Convert a floating point number to a Decimal with no loss of information |
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.db import models | |
| from django.core.mail import send_mail | |
| from django.contrib import auth | |
| from django.contrib.auth.models import ( | |
| AbstractBaseUser, | |
| BaseUserManager, | |
| Group, | |
| Permission, | |
| _user_get_all_permissions, | |
| _user_has_perm, |
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 -*- | |
| import random | |
| STREET_NAMES = [ | |
| 'Steve', | |
| 'Thyme', | |
| 'Rigby', | |
| 'Chedder', |
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 jingo import register | |
| @register.filter | |
| def beats(obj): | |
| t = obj.timetuple() | |
| bmt = (t.tm_hour * 3600) + (t.tm_min * 60) + t.tm_sec | |
| return '%.0f' % (bmt / 86.375) |
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.db import models | |
| from django.core.mail import send_mail | |
| from django.contrib.auth.models import ( | |
| AbstractBaseUser, | |
| BaseUserManager, | |
| PermissionsMixin, | |
| ) | |
| from django.utils.translation import ugettext_lazy as _ | |
| from django.utils import timezone |
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 json | |
| from django.http import HttpResponse | |
| def as_json(func): | |
| def decorator(request, *ar, **kw): | |
| output = func(request, *ar, **kw) | |
| if not isinstance(output, dict): |