Skip to content

Instantly share code, notes, and snippets.

Guilherme de Carvalho Carneiro guilhermecarvalhocarneiro

Block or report user

Report or block guilhermecarvalhocarneiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
EBNull /
Created Aug 17, 2011
Returns all foreign key relations to a django model and their accessors
#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
vinidmpereira /
Last active May 21, 2019
get_current_user middleware.
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()
gcko /
Last active Jan 28, 2020
Django Custom Model ForeignKey Field for Spanning Databases
You can’t perform that action at this time.