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
EBNull / relations.py
Created Aug 17, 2011
Returns all foreign key relations to a django model and their accessors
View relations.py
#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
vinidmpereira / example_current_user.py
Last active May 21, 2019
get_current_user middleware.
View example_current_user.py
"""
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
gcko / related.py
Last active Dec 11, 2019
Django Custom Model ForeignKey Field for Spanning Databases
View related.py
You can’t perform that action at this time.