Skip to content

Instantly share code, notes, and snippets.

@tedtieken
tedtieken / paginated_collection.js
Created August 22, 2012 22:39 — forked from takinbo/paginated_collection.js
Pagination with Backbone.js & django-tastypie
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by');
typeof(options) != 'undefined' || (options = {});
typeof(this.limit) != 'undefined' || (this.limit = 20);
typeof(this.offset) != 'undefined' || (this.offset = 0);
typeof(this.filter_options) != 'undefined' || (this.filter_options = {});
typeof(this.sort_field) != 'undefined' || (this.sort_field = '');
@tedtieken
tedtieken / django_2012.md
Created August 5, 2012 18:17 — forked from trey/django_2012.md
How to start a Django project in 2012

How to start a Django project in 2012

(and deploy to Heroku)

First, warm up system.

$ easy_install pip
$ pip install virtualenv
$ pip install django
$ gem install heroku
@tedtieken
tedtieken / track_data.py
Created January 3, 2012 21:39 — forked from dcramer/track_data.py
Tracking changes on properties in Django
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @track_data('name')