Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
#!/bin/bash
# devpi install for a dedicated ubuntu server with upstart
# based on http://tim.freunds.net/blog/devpi.html
# execute as root (sudo)
set -ex # exit on error, print executed commands
DEVPI_VENV=/opt/devpi
DEVPI_USER=devpi
# -*- coding: utf-8 -*-
"""Refactor South migrations to use settings.AUTH_USER_MODEL.
Inserts a backwards-compatible code-snippet in all
your schema migration files and uses a possibly customized user
model as introduced in Django 1.5.
Please note that this has nothing to do with changing
settings.AUTH_USER_MODEL to a new model. If you do this, stuff
will very likely break in reusable apps that have their own
migration trees.
@stefanfoulis
stefanfoulis / chainable_manager.py
Created November 9, 2012 13:56 — forked from ojii/chainable_manager.py
Django Model Managers
from django.db import models
from django.db.models.query import QuerySet
class ChainableManager(models.Manager):
"""
A manager that allows chaining of all methods defined on it.
Example:
class MyManager(ChainableManager):
@stefanfoulis
stefanfoulis / search_indexes.py
Created May 4, 2010 08:08 — forked from beniwohli/search_indexes.py
fork with support for cms placeholders (upcoming cms 2.1 release)
from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy
from django.utils.html import strip_tags
from haystack import indexes, site
from cms.models.managers import PageManager
from cms.models.pagemodel import Page
from cms.models.pluginmodel import CMSPlugin