models.py
class MyUser(AbstractUser):
idstaff = models.CharField(max_length=255)
class Meta:
db_table = 'myuser'
swappable = 'AUTH_USER_MODEL'
<html> | |
<head> | |
<script src="/js/html2canvas.min.js"></script> | |
</head> | |
<body> | |
<button class="screen-shot">ScreenShot</button> | |
<script> | |
var btn = document.querySelector('.screen-shot'); | |
btn.addEventListener("click", function() { | |
if (!window.opener || window.opener.closed) { |
import functools | |
import time | |
def retry(exception, max_retry, sleep, err_handler): | |
""" Catching exception and retrying | |
""" | |
def dec(f): | |
@functools.wraps(f) | |
def _wrapped(*args, **kwargs): |
from collections import OrderedDict | |
class PHPArray(OrderedDict): | |
def __init__(self): | |
super().__init__() | |
self.next_max_index = 0 | |
def __setitem__(self, key, val): | |
if isinstance(key, int): |
<script> | |
directives: { | |
'inner-height': { | |
bind: function() { | |
this.el.addEventListener('load', () => { | |
var doc = this.el.contentDocument || this.el.contentWindow.document; | |
this.el.style.height = doc.body.scrollHeight + 'px'; | |
}); | |
} | |
} |
import statistics | |
class Field: | |
def __init__(self, field, agg_func=lambda l: l[0]): | |
self.field = field | |
self.agg_func = agg_func | |
def aggregate(self, l): | |
return self.agg_func(l) |
;; Moving start line and start indend by C-a | |
(defun back-to-indentation-or-beginning () (interactive) | |
(if (= (point) (progn (back-to-indentation) (point))) | |
(beginning-of-line))) | |
(global-set-key "\C-a" 'back-to-indentation-or-beginning) |
toJson() { | |
return JSON.stringify(this, (key, value) => { | |
if (key == 'parent') { | |
return value.id; | |
} else { | |
return value; | |
} | |
}); | |
} |
models.py
class MyUser(AbstractUser):
idstaff = models.CharField(max_length=255)
class Meta:
db_table = 'myuser'
swappable = 'AUTH_USER_MODEL'