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 import settings | |
from templated_mail.mail import BaseEmailMessage | |
class VerificationEmail(BaseEmailMessage): | |
template_name = 'email/email_verification.html' | |
def get_context_data(self): | |
# Get context and user |
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
#!/usr/bin/env python | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
import tornado.websocket | |
import tornado.wsgi | |
from myapp.wsgi import application as myapp_wsgi | |
# Javascript Usage: |
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 sqlalchemy import Column, Integer, create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
# a model | |
class Thing(Base): | |
__tablename__ = 'thing' | |
id = Column(Integer, primary_key=True) |
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> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
(function () { | |
var onMessage = function (data) { | |
// Do something with the message data | |
}; |
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 base64 | |
import enum | |
from typing import Any, Optional, Annotated | |
from sqlalchemy import select | |
from sqlalchemy.ext.asyncio import AsyncSession | |
from sqlalchemy.orm import InstrumentedAttribute, DeclarativeMeta | |
from sqlalchemy.sql import Select | |
from gql.modules.users._fields import UserOrder |
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
""" | |
- Add some settings - | |
Log in to your sandbox account and get your API keys plus your merchant ID. | |
""" | |
BRAINTREE_PRODUCTION = False # We'll need this later to switch between the sandbox and live account | |
BRAINTREE_MERCHANT_ID = “your_merchant_id” | |
BRAINTREE_PUBLIC_KEY = “your_public_key” | |
BRAINTREE_PRIVATE_KEY = “your_private_key” |
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 re | |
from django import forms | |
from django.db import models | |
class ColourFormField(forms.IntegerField): | |
default_error_messages = { | |
'invalid': 'Enter a valid colour value: e.g. "#ff0022"', | |
} | |
def __init__(self, *args, **kwargs): |
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
urlpatterns = [ | |
url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', ConfirmEmailView.as_view(), name='account_confirm_email'), | |
] |
OlderNewer