This file contains hidden or 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
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
uglify: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
}, | |
build: { |
This file contains hidden or 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
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
uglify: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
}, | |
build: { |
This file contains hidden or 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 random | |
from django.test import TestCase | |
from django.utils.text import slugify | |
from account.models import WUser | |
from classes.models import Classroom, Attendance | |
# Create your tests here. |
This file contains hidden or 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
class Classroom(models.Model): | |
name = models.CharField(max_length=100) | |
code = models.CharField(max_length=10, unique=True, default=_create_small_code) | |
students = models.ManyToManyField(WUser, through='Attendance') | |
creation = models.DateTimeField(auto_now_add=True) | |
def __unicode__(self): | |
return self.name | |
def class_code(self): |
This file contains hidden or 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
class CheckoutView(View): | |
form_class = CheckoutForm | |
template = 'account/checkout.html' | |
email_template_name = 'account.checkout_success' | |
def create_sub(self, user, customer, plan, quantity): | |
subscription = customer.subscriptions.create(plan=plan, quantity=quantity) | |
user.stripe_subscription_id = subscription.id | |
user.save() |
This file contains hidden or 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
<link rel="stylesheet/less" href="../assets/less/pages/module.front.page.index.less" /> | |
<script src="../assets/components/core/lib/jquery/jquery.min.js"></script> | |
<script src="../assets/components/core/lib/jquery/jquery-migrate.min.js"></script> | |
<script src="../assets/components/core/lib/plugins/less-js/less.min.js"></script> |
This file contains hidden or 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
/* --- LOADING [css.bootstrap.min] from assets/components/core/lib/bootstrap/css/bootstrap.min.css */ | |
@import '../../../assets/components/core/lib/bootstrap/css/bootstrap.min.css'; | |
/* --- LOADING [css.font-awesome.min] from assets/components/ui/icons/fontawesome/assets/css/font-awesome.min.css */ | |
@import '../../../assets/components/ui/icons/fontawesome/assets/css/font-awesome.min.css'; | |
/* --- LOADING [css.glyphicons_regular] from assets/components/ui/icons/glyphicons/assets/css/glyphicons_regular.css */ | |
@import '../../../assets/components/ui/icons/glyphicons/assets/css/glyphicons_regular.css'; |
This file contains hidden or 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
class UpgradeView(View): | |
form_class = CheckoutForm | |
template = 'account/checkout.html' | |
def create_sub(self, user, customer, plan, quantity): | |
subscription = customer.subscriptions.create(plan=plan, quantity=quantity) | |
user.stripe_subscription_id = subscription.id | |
user.save() | |
def get(self, request, *args, **kwargs): |
This file contains hidden or 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
def post(self, request, *args, **kwargs): | |
form = CheckoutForm(request.POST) | |
if form.is_valid(): | |
user = request.user | |
stripe.api_key = settings.STRIPE_SECRET | |
token = form.cleaned_data['stripe_token'] | |
quantity = form.cleaned_data.get('quantity', 1) | |
customer = stripe.Customer.retrieve(user.stripe_customer_id) | |
customer.card = token | |
customer.save() |
This file contains hidden or 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
class LicenseVerifyView(View): | |
def render_to_json_response(self, context, **response_kwargs): | |
data = json.dumps(context) | |
response_kwargs['content_type'] = 'application/json' | |
return HttpResponse(data, **response_kwargs) | |
def get(self, request, *args, **kwargs): | |
if request.is_ajax(): | |
data = { |