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
define(['jquery', 'jqBootstrapValidation', 'bootbox'], function (require, exports) { | |
"use strict"; | |
/*** | |
* 符合promise及bootstrap规范的窗体帮助类. | |
* | |
* 自动绑定到标记有ajaxform类的窗体,并且提供使用jqBootstrapValidation验证功能 | |
* | |
* 需要实例化才能使用 | |
*/ |
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
define(['jquery', 'bootstrap'], function (require, exports) { | |
"use strict"; | |
var $ = require('jquery'); | |
/** | |
* 上传单个文件 | |
* @param $form 要监控的表单对象 | |
* @param $file 要监控的文件对象 | |
* @param $img 完成后显示结果的控件 |
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.conf import LazySettings | |
def _setup_proxy(): | |
''' | |
初始化proxy | |
@return: | |
''' | |
settings = LazySettings() |
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
/* ---- Begin integration of Underscore template engine with Knockout. Could go in a separate file of course. ---- */ | |
ko.underscoreTemplateEngine = function () { | |
}; | |
ko.underscoreTemplateEngine.prototype = ko.utils.extend(new ko.templateEngine(), { | |
renderTemplateSource: function (templateSource, bindingContext, options) { | |
// Precompile and cache the templates for efficiency | |
var precompiled = templateSource['data']('precompiled'); | |
if (!precompiled) { | |
precompiled = _.template("<% with($data) { %> " + templateSource.text() + " <% } %>"); | |
templateSource['data']('precompiled', precompiled); |
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 OrganCreateView(PagedPerviousMixin, CreateView): | |
model = Organ | |
form_class = OrganForm | |
template_name = 'shared/admin/organ_form.html' | |
def get_context_data(self, **kwargs): | |
context = super(OrganCreateView, self).get_context_data(**kwargs) | |
if self.request.method == 'POST': |
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
MODE_PROVINCE = 10000 | |
MODE_CITY = 100 | |
def D(district_field_name, district_id): | |
''' | |
获取区域选筛选表达式 | |
@param district_field_name: | |
@param district_id: | |
@return:(字段表达式,值) |
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
import socks | |
import socket | |
proxy_type, proxy_ip, proxy_port = settings.PROXY_SERVER | |
socks.setdefaultproxy(proxy_type, proxy_ip, proxy_port) | |
socket.socket = socks.socksocket | |
def _create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): | |
msg = "getaddrinfo returns an empty list" | |
host, port = address |