This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
urlpatterns = [ | |
# ... | |
] | |
handler400 = 'apps.common.views.handler400' | |
handler403 = 'apps.common.views.handler403' |
This file contains hidden or 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
# -*- coding: utf-8 -* | |
from __future__ import unicode_literals | |
import logging | |
from django.conf import settings | |
from importlib import import_module | |
engine = import_module(settings.SESSION_ENGINE) | |
SessionStore = engine.SessionStore |
This file contains hidden or 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
karma-angular |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django.core.urlresolvers import reverse | |
from django.utils.translation import ugettext_lazy as _ | |
from admin_tools.dashboard import modules | |
from admin_tools.dashboard import Dashboard | |
from admin_tools.menu import Menu | |
from admin_tools.menu import items | |
from project.dashboard_modules import WorkedTaskDashboardModuleChart |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django import template | |
register = template.Library() | |
@register.assignment_tag(takes_context=True) | |
def is_owner(context, obj, user, field_name='user'): | |
return getattr(obj, field_name, None) == user |
This file contains hidden or 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
var server = require('webserver').create(); | |
var port = 9091; | |
var getPage = function(url, callback) { | |
var page = require('webpage').create(); | |
page.open(url, function() { | |
setTimeout(function() { | |
page.evaluate(function() { | |
$('meta[name=fragment], script').remove() |
This file contains hidden or 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
'use strict'; | |
angular.module('appName') | |
.directive 'birthday', () -> | |
return { | |
restrict: 'E' | |
scope: | |
date: '=' | |
yearBegin: '=' | |
yearEnd: '=' |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django import template | |
register = template.Library() | |
@register.filter() | |
def phone(value): | |
return '+%s %s %s %s %s' % (value[0], |
This file contains hidden or 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.core.context_processors import csrf | |
str(csrf(request)['csrf_token']) |
This file contains hidden or 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
class Entity(models.Model): | |
somefile = model.FileField(upload_to='files') |