Skip to content

Instantly share code, notes, and snippets.

View alxpck's full-sized avatar

Alex Peck alxpck

View GitHub Profile
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import timezone
from .models import Course, Step
# Create your tests here.
class CourseModelTests(TestCase):
def test_course_creation(self):
course = Course.objects.create(
from django import forms
class StripeForm(forms.Form):
stripe_token = forms.CharField()
import stripe
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.views.generic import FormView, TemplateView
from .forms import StripeForm
class StripeMixin(object):
from django.conf.urls import patterns, url
from .views import SubscribeView, SuccessView
urlpatterns = patterns(
'',
url(r'^subscribe/$', SubscribeView.as_view(), name='subscribe'),
url(r'^thank_you/$', SuccessView.as_view(), name='thank_you'),
)
{% extends "base.html" %}
{% block head %}
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script type="text/javascript">
Stripe.setPublishableKey('{{ publishable_key }}');
var stripeResponseHandler = function(status, response) {
var $form = $('#checkout-form');
<!doctype html>
<html>
<head>
<title>
{% block title %}Site Title{% endblock %}
</title>
</head>
<body>
<div>
<a href="{% url "index" %}">Home</a>
DJSTRIPE_PLANS = {
"monthly": {
"stripe_plan_id": "pro-monthly",
"name": "Web App Pro ($25/month)",
"description": "The monthly subscription plan to WebApp",
"price": 2500, # $25.00
"currency": "usd",
"interval": "month"
},
"yearly": {
import stripe
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.views.generic import FormView, TemplateView
from djstripe.models import Customer
from .forms import StripeForm
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
echo "All good things are wild and free."
echo " —-h. d. thoreau"
[[ -s ~/.bashrc ]] && source ~/.bashrc
export CLICOLOR=1
export TERM=xterm-256color
# Sublime Text alias
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'