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.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( |
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 import forms | |
class StripeForm(forms.Form): | |
stripe_token = forms.CharField() |
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
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): |
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.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'), | |
) |
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
{% 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'); |
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
<!doctype html> | |
<html> | |
<head> | |
<title> | |
{% block title %}Site Title{% endblock %} | |
</title> | |
</head> | |
<body> | |
<div> | |
<a href="{% url "index" %}">Home</a> |
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
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": { |
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
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 |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
class Migration(migrations.Migration): | |
dependencies = [ | |
] |
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
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' |