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.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): |
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
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 |
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
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 |
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
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)] |
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
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') |