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
""" | |
This should be a separate file, i usually install it on the maind django project folder. | |
""" | |
from threading import local | |
from django.utils.deprecation import MiddlewareMixin | |
_user = local() |
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 |