Skip to content

Instantly share code, notes, and snippets.

@hsparikh
hsparikh / registration.py
Created November 26, 2011 17:34
django-userena
class SignupForm(forms.Form):
"""
Form for creating a new user account.
Validates that the requested username and e-mail is not already in use.
Also requires the password to be entered twice and the Terms of Service to
be accepted.
"""
username = forms.RegexField(regex=USERNAME_RE,
@hsparikh
hsparikh / django-crossdomainxhr-middleware.py
Created October 13, 2012 05:13
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
"adult": false,
"backdrop_path": "/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg",
"belongs_to_collection": null,
"budget": 63000000,
"genres": [
{
"id": 28,
"name": "Action"
},
{
@hsparikh
hsparikh / trickster.io - Movies (Collections)
Created December 13, 2012 05:18
trickster.io - Movies (Collections)
{
"id": 1,
"page": 1,
"results": [
{
"backdrop_path": "/gmLMaDXi4lFWG8WitaCYOJS5GtL.jpg",
"id": 12180,
"original_title": "Star Wars: The Clone Wars",
"release_date": "2008-08-15",
"poster_path": "/xd6yhmtS6mEURZLwUDT5raEMbf.jpg",
@hsparikh
hsparikh / dataset-filter.json
Last active May 4, 2016 10:59 — forked from jpatel3/dataset-filter.json
Tuva datasets filter menu config
[{
"filter_name": "Subject",
"children": [{
"name": "",
"tags": [{
"name": "Community",
"description": "Community"
}, {
"name": "Politics",
"description": "Politics"
@hsparikh
hsparikh / dataset-filter.json
Last active September 19, 2016 05:17 — forked from naveenkumarganesan/dataset-filter.json
Tuva datasets filter menu config
[{
"filter_name": "Subject",
"filter_title": "Subject / Topic",
"children": [{
"name": "",
"tags": [{
"name": "Community",
"description": ""
},{
"name": "Culture",