This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Some utilities for django projects | |
A few others: | |
https://github.com/andymccurdy/django-tips-and-tricks/blob/master/model_update.py | |
https://bitbucket.org/weholt/dse2 | |
""" | |
import sys, os, string, random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models.fields import Field | |
import types | |
def patch_model(model_to_patch, class_to_patch_with): | |
""" | |
Adapted from http://www.ravelsoft.com/blog/2010/patchmodel-hacky-solution-extending-authuser-class | |
Monkey patch a django model with additional or replacement fields and methods. | |
All fields and methods that didn't exist previously are added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Feed, FeedItem, FeedItems, Feeds, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
Feeds = (function(_super) { | |
__extends(Feeds, _super); |