摘要: 全选 共选中0条 阅读全文
posted @ 2019-01-07 09:44 xsan 阅读(613) 评论(0) 推荐(1) 编辑
摘要: 全选 阅读全文
posted @ 2019-01-06 11:04 xsan 阅读(2496) 评论(0) 推荐(1) 编辑
摘要: function change_style() { $.ajax({ url: "{% url 'change_style' %}", type: "GET", dataType: 'json', data: {'product_category':$('select.product_categor 阅读全文
posted @ 2018-12-20 13:40 xsan 阅读(1437) 评论(0) 推荐(0) 编辑
摘要: 如果是提交表单时,可以通过$('#update_form').serialize(),直接打包提交。 阅读全文
posted @ 2018-12-20 10:06 xsan 阅读(13868) 评论(0) 推荐(1) 编辑
摘要: 删除 阅读全文
posted @ 2018-12-20 09:46 xsan 阅读(231) 评论(0) 推荐(0) 编辑
摘要: var str=new String(); var arr=new Array(); str="ddd,dsd,3,dd,g,k"; //可以用字符或字符串分割 arr=str.split(','); for(var i=0;i<arr.length;i++) { alert(arr[i]); } 阅读全文
posted @ 2018-12-11 19:41 xsan 阅读(896) 评论(0) 推荐(0) 编辑
摘要: 1、 去掉字符串前后所有空格: 代码如下: function Trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } 阅读全文
posted @ 2018-12-11 19:39 xsan 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 1 import numpy as np 2 3 ######################## 4 # 索引 5 n1 = np.random.randint(0, 100, 10) 6 # print(n1) 7 ''' 8 [68 27 40 11 18 6 61 62 67 31] 9 ''' 10 # print(n1[5]) 11 '''... 阅读全文
posted @ 2018-11-30 21:17 xsan 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 1 import numpy as np 2 3 # 创建 4 # 创建一维数组 5 a = np.array([1, 2, 3]) 6 print(a) 7 ''' 8 [1 2 3] 9 ''' 10 # 创建多维数组 11 b = np.array([(1, 2, 3), (4, 5, 6)]) 12 print(b) 13 ''' 14 [... 阅读全文
posted @ 2018-10-28 17:07 xsan 阅读(2873) 评论(0) 推荐(0) 编辑
摘要: 注意: 1、 关闭输入框的历史记录功能 ,autocomplete="off"。否则会将用户的输入历史记录也显示出来。 2、datalist标签的id要与input标签的list属性的值一致。 3、动态获取input的输入值,给input标签绑定“keyup”事件。 4、本实例使用了jQuery和b 阅读全文
posted @ 2018-10-08 11:25 xsan 阅读(6929) 评论(0) 推荐(0) 编辑
摘要: django下载Excel,使用django-excel插件 由于目前的资料多是使用pandas或xlwt库实现的。其实没有那么的麻烦,因为django有相对应的插件django-excel。 该插件是依赖于pyexcel库写的。不过,不用专门安装pyexcel库,因为在安装django-excel 阅读全文
posted @ 2018-09-30 08:58 xsan 阅读(4470) 评论(0) 推荐(0) 编辑
摘要: django操作多数据库 1、 添加数据库路由分配文件 在项目文件夹里创建‘database_router’文件。将下面的代码复制到该文件里。 2、在settings.py文件中配置多数据库 #设置数据库路由,将django_test改为你项目的名称。 DATABASE_ROUTERS = ['dj 阅读全文
posted @ 2018-09-15 18:33 xsan 阅读(817) 评论(0) 推荐(0) 编辑
摘要: 加载并全屏轮播加载的其他网站的页面 一、 设计思路 1、使用iframe标签加载其他网站页面 2、通过js替换iframe的加载链接 3、通过js的定时器实现轮播 4、通过js实现全屏 二、代码小解 1、加载页面 <iframe src="https://www.baidu.com" width=' 阅读全文
posted @ 2018-09-02 13:47 xsan 阅读(828) 评论(0) 推荐(0) 编辑
摘要: 方式一:from django.views.decorators.csrf import csrf_exemptfrom django.utils.decorators import method_decoratorfrom django.views import Viewclass Goods_v 阅读全文
posted @ 2018-08-31 17:21 xsan 阅读(726) 评论(0) 推荐(0) 编辑
摘要: 解决django配合nginx部署后admin样式丢失 1、 在项目的settings.py文件里添加以下内容: STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATIC_ROOT = 阅读全文
posted @ 2018-08-15 16:36 xsan 阅读(842) 评论(0) 推荐(0) 编辑
摘要: Centos7安装anaconda3 1、 安装bunzip2 yum install bunzip2 2、 下载anaconda3 wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh 3、 安装anacond 阅读全文
posted @ 2018-07-30 19:02 xsan 阅读(338) 评论(0) 推荐(0) 编辑
摘要: from flask import Flask app = Flask(__name__) # app.config.update(DEBUG=True)#开启debug模式 #加载配置文件方法一 # import config # app.config.from_object(config) # 加载配置文件方法二 app.config.from_pyfile('config.py') ... 阅读全文
posted @ 2018-07-10 21:18 xsan 阅读(626) 评论(0) 推荐(0) 编辑
摘要: #导入urllib库 import urllib.request #打开网址 file=urllib.request.urlopen("http://www.sohu.com/",timeout=5) #读取网页源码 file.read().decode("utf-8","ignor") #返回爬取网页的状态码 print(file.getcode()) #获取当前访问网页的url print(... 阅读全文
posted @ 2018-04-14 17:17 xsan 阅读(259) 评论(0) 推荐(0) 编辑
摘要: urllib下使用Xpath表达式示例 使用xpath表达式需要先将需要匹配的数据转换成tree格式,这就需要先装lxml模块。安装方法可以使用pip安装。 示例代码: 补充知识点: 阅读全文
posted @ 2018-03-25 11:32 xsan 阅读(513) 评论(0) 推荐(0) 编辑
摘要: pip升级所有python包import pipfrom subprocess import callfor dist in pip.get_installed_distributions(): call("pip install --upgrade " + dist.project_name, s 阅读全文
posted @ 2018-03-22 16:54 xsan 阅读(209) 评论(0) 推荐(0) 编辑