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
""" | |
Before loading an admin template, it first modifies the template name based on the current thread's request url. | |
It will also fall back to the standard template name if themodified one is not found. | |
This uses a threadlocal hack. | |
settings.py: | |
MIDDLEWARE_CLASSES = ( | |
..., | |
'AdminTemplateRedirector.AdminTemplateRedirectorMiddleware', | |
... |
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
#Some utilities to work with django models and foreign keys. | |
#Especially useful for finding (and writing out) code to illuminate information about relations. | |
# | |
#To try it out, run show_relation_accessors(model) in a python prompt, or to be more general, get_related_instance_ids_code(model) | |
# | |
#-2011 CBWhiz | |
# | |
# | |
#Usage sample: | |
# from django.db import transaction |
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.conf import settings | |
#STICKY_DB_DEFAULT=None | |
#STICKY_DB_ALLOW_CROSS_DB_RELATIONS=False | |
#STICKY_DB_MODELS = { | |
# ('app', 'model'): 'dbalias', | |
# ('app', 'model'): 'dbalias', | |
# ('app', 'model'): 'dbalias', | |
#} |
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
#Run this script to install system files, port monitor, port, driver, and printer | |
#You can change settings in the main() function | |
# | |
#(c) 2011 CBWhiz | |
import os | |
import sys | |
import ctypes | |
import subprocess | |
import codecs | |
import tempfile |
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 code, sys | |
from code import softspace | |
class GlobalInteractiveConsole(code.InteractiveConsole): | |
"""Interactive console that also takes a globals argument""" | |
def __init__(self, locals=None, filename="<console>", globals=None): | |
try: | |
super(GlobalInteractiveConsole, self).__init__(locals=locals, filename=filename) | |
except TypeError: | |
code.InteractiveConsole.__init__(self, locals=locals, filename=filename) | |
if globals is None: |
NewerOlder