Skip to content

Instantly share code, notes, and snippets.

# Bayram Kaya 17.03.2019
# Wrapper function checks if requester has db_model instance
def check_profile(db_model):
def req_wrapper(func):
def func_wrapper(request):
placeholder = db_model.objects.filter(name=request.user)
if placeholder.exists():
return func(True,request)
else:
@ByK95
ByK95 / object-watch.js
Last active March 15, 2019 15:48 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
*Forked from Eli Grey https://gist.github.com/eligrey/384583
*
*/
// object.watch
if (!Object.prototype.watch) {
Object.defineProperty(Object.prototype, "watch", {
enumerable: false
, configurable: true