Skip to content

Instantly share code, notes, and snippets.

View zvictor's full-sized avatar
🐥

Victor Duarte zvictor

🐥
View GitHub Profile
@zvictor
zvictor / models.py
Created November 9, 2011 11:24
An example how to connect userena with django-social registration.
from socialregistration.signals import connect as profile_connect
from userena.managers import ASSIGNED_PERMISSIONS
@receiver(socialregistration_signals.connect, sender = FacebookProfile, dispatch_uid = 'facebook.connect')
def social_connect_callback(sender, user, profile, client, **kwargs):
"""
Create a profile for this user after connecting
"""
# Create a userena user.
@zvictor
zvictor / django-crossdomainxhr-middleware.py
Created June 10, 2012 20:50 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS