Skip to content

Instantly share code, notes, and snippets.

from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
class User(AbstractUser):
"""Custom user model for future extension"""
class BalanceType(models.Model):
@anddam
anddam / grub.cfg
Last active August 29, 2015 14:21 — forked from iamleot/grub.cfg
set timeout=2
set default=0
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
menuentry "NetBSD" {
knetbsd (hd0,gpt5)/netbsd -r dk4
tell application "Safari"
activate
open location "http://www.google.com"
delay 3
set theScript to "document.getElementById('lst-ib').value = 'hello world'"
do JavaScript theScript in current tab of first window
end tell
@anddam
anddam / results
Last active December 9, 2022 14:45 — forked from anonymous/untitled.py
SQLAlchemy aggregate functions example
In [29]: my_sub = db.session.query(TestModel.name, func.count(TestModel.id).label('count')).group_by(TestModel.name).subquery()
In [30]: db.session.query(TestModel, my_sub.c.count).outerjoin(my_sub, TestModel.name==my_sub.c.name).all()
Out[30]: [(<1: Bob>, 1), (<2: Alice>, 2), (<3: Alice>, 2)]
@anddam
anddam / scratch.py
Created December 11, 2013 20:52 — forked from doobeh/scratch.py
def current_departments():
return Department.query
class TransferForm(Form):
sender = SelectField('From', choices=[('001', 'IGA'), ('003', 'Gourmet'), ('002', 'Wholesale')])
receiver = SelectField('To', choices=[('001', 'IGA'), ('003', 'Gourmet'), ('002', 'Wholesale')])
department = QuerySelectField('Department', query_factory=current_departments)
amount = TextField('Amount')