Pattern for email sending.
- Easy to grep project for where emails get sent.
- Easy to send the same email from multiple places.
- Constructs urls in a reliable way such that you don't get ssl errors for missing
www
.
$ brew install macvim | |
==> Downloading https://github.com/b4winckler/macvim/tarball/snapshot-63 | |
File already downloaded in /Users/jillkatzenberger/Library/Caches/Homebrew | |
==> ./configure --with-features=huge --with-tlib=ncurses --enable-multibyte --with-macarchs=x86_ | |
==> make | |
Starting make in the src directory. | |
If there are problems, cd to the src directory and run make there | |
cd src && make first | |
mkdir objects | |
CC="gcc -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -no-cpp-precomp -I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1 " srcdir=. sh ./osdef.sh |
class Listing(...): | |
def upgrade(self): | |
return self.__class__.objects.select_subclasses().get(pk=self.pk) | |
listing = Listing.objects.get(pk=1) | |
buyerlisting = listing.upgrade() |
# Using postgis 2.0.1 | |
# Table creation sql | |
BEGIN; | |
CREATE TABLE "locations_location" ( | |
"id" serial NOT NULL PRIMARY KEY, | |
"name" varchar(255) NOT NULL, | |
"location" GEOMETRY(POINT, 4326) | |
) | |
; |
class BaseViewMixin(object): | |
def dispatch(self, request, *args, **kwargs): | |
# Set earlier to ensure that other class methods which expect | |
# these values to be present can be called in `init` | |
self.request = request | |
self.args = args | |
self.kwargs = kwargs | |
# Run the complete request, returning a response, but allowing | |
# `init` to either raise exceptions, or hijack the response if |
from django.utils.http import is_safe_url | |
from django.core.urlresolvers import reverse | |
from django.utils.safestring import mark_safe | |
class WithNextUrlMixin(object): | |
""" | |
This view will use whatever value was submitted as `next` as the success | |
url, as long as the url resolves correctly. | |
""" |
Pattern for email sending.
www
.class ClearableFileInput(widgets.ClearableFileInput): | |
""" | |
Changes the default file widget to be easier to target with CSS | |
""" | |
template_with_initial = u'<div class="fileField"><span class="currently">%(initial_text)s:</span> %(initial)s %(clear_template)s<span class="change">%(input_text)s:</span> %(input)s</div>' | |
template_with_clear = u'<div class="clear">%(clear)s <label for="%(clear_checkbox_id)s">%(clear_checkbox_label)s</label></div>' | |
initial_template = u'<a href="{{url}}">{{name}}</a>' | |
def render(self, name, value, attrs=None): |
import requests | |
import csv | |
from dateutil import parser | |
from BeautifulSoup import BeautifulSoup | |
CACHE = {} | |
""" | |
https://us.pycon.org/2013/schedule/presentation/35/ | |
https://us.pycon.org/2013/schedule/presentation/68/ |
from urlparse import urljoin | |
from django.contrib.auth.tokens import default_token_generator | |
from django.utils.http import int_to_base36 | |
from django.contrib.sites.models import Site | |
from django.core.urlresolvers import reverse | |
from emailtools import MarkdownEmail | |
@celery.task | |
def first(): | |
# generates an iterable | |
return 1, 2, 3 | |
@celery.task | |
def second(thing): | |
""" | |
Takes a single item from the iterable from `first`, does some computation, |