跳至主要内容

Django Models的数据类型

 

AutoField
 
IntegerField
BooleanField
true/false
 
CharField
maxlength,必填
 
TextField
 
 
CommaSeparatedIntegerField
maxlength,必填
逗号分隔
DateField

auto_now
可选,每次动作都会更新
auto_now _add
可选,一次产生

 
DateTimeField

auto_now
可选,每次动作都会更新
auto_now _add
可选,一次产生

 
EmailField
 
 
FileField
upload_to,可选
object.get_myfile_url
FilePathField

path
必填"/home/images"
match
可选,正则表达式,用于过滤文件名
recursive
可选,False,表示path的子目录是否包含在内

 
FloatField

max_digits
必填,数字长度
decimal_places
必填,即有效位数

 
 
ImageField

upload_to
 
height_field
可选
width_field
可选

需要验证,即PythonImaging Library
IntegerField
 
 
IPAddressField
 
 
NullBooleanField
 
相当于设置了null=True的BooleanField
PhoneNumberField
 
美国电话号码格式
PositiveIntegerField
 
正整数字段
PositiveSmallIntegerField
 
小的正整数字段,取决于数据库特性
SlugField

maxlength(50)
可选
db_index
默认为True
prepopulate_from
可选,用于指示在admin表单中的可选值

短标签,仅包含字母、数字、下划线、连字符,一般用于url
SmallIntegerField
 
小整数字段,依赖于数据库特性
TimeField

auto_now
可选,每次动作都会更新
auto_now _add
可选,一次产生

 
URLField
verify_exists(True),检查URL可用性
 
USStateField
 
两个字母表示的美国州名字段
XMLField
schema_path,必选
 

评论

  1. As talked about above, take clean steps harmonizing together with your 점보카지노 financial status and alternatives. Make betting a small part of of} your leisure program, and don't let it become too important to you. Let it's a method to have occasional enjoyable, however all the time prioritize your every day responsibilities.

    回复删除
  2. A 카지노사이트 image would only appear as soon as} on the reel displayed to the player, however might, in reality, occupy quantity of} stops on the quantity of} reel. Historically, all slot machines used revolving mechanical reels to show and determine results. Although the unique slot machine used 5 reels, less complicated, and therefore extra reliable, three reel machines quickly turned the standard. Short pay refers to a partial payout made by a slot machine, which is less than the amount end result of} player.

    回复删除

发表评论

此博客中的热门博文

Django使用markdown

Django使用markdown 安装markdown Pygments xxxxxxxxxx pip install Pygments markdown 生成css文件 xxxxxxxxxx pygmentize -S default -f html -a .codehilite > pygments.css -S 选择高亮模板,查看支持的高亮模板 xxxxxxxxxx from pygments . styles import STYLE_MAP STYLE_MAP . keys () 在对应APP添加 templatetags文件夹 custom_markdown.py xxxxxxxxxx import markdown from django import template from django . template . defaultfilters import stringfilter from django . utils . safestring import mark_safe register = template . Library () #自定义filter时必须加上 @register . filter ( is_safe = True ) #注册template filter @stringfilter       #希望字符串作为参数 def custom_markdown ( value ):     return mark_safe ( markdown . markdown ( value ,         extensions =[ 'markdown.extensions.fenced_code' , 'markdown.extensions.codehilite' ],         safe_mode = True ,         enable_attributes = False )) 模板中引用 xxxxxxxxxx {% load custom_markdown %...

web管理openvpn

  web管理openvpn 一部署目标 客户端使用openvpn客户端使用证书密钥+用户密码验证登录,拨入内网 服务器端使用mysql存储用户信息,并加密用户密码 开发openvpn管理平台,可以web界面管理openvpn 指定人员IP,通过策略限制人员访问资源 二部署openvpn 1安装openvpn服务端 1.1环境 系统 centos7.3 IP地址 100.100.100.100 Openvpn版本 2.4.3 安装方式 YUM 数据库 percona-server-5.7.18-15 验证工具 pam_mysql openvpn插件版本 2.0.9 1.2安装依赖 yum -y install epel-release yum install pam-devel pam yum install -y easy-rsa yum -y install mariadb-server mariadb-devel mariadb-libs yum install -y cyrus-sasl cyrus-sasl-plain cyrus-sasl-devel cyrus-sasl-lib cyrus-sasl-gssapi 1.3安装openvpn 使用yum命令安装openvpn yum install -y openvpn 1.4配置证书密钥 复制证书密钥工具 #cp -R /usr/share/easy-rsa /etc/openvpn/ 进入工具目录 #cd /etc/openvpn/easy-rsa 修改证书生成信息 #vim /etc/openvpn/easy-rsa/2.0/vars export KEY_COUNTRY="CN" export KEY_PROVINCE="CA" export KEY_CITY="HangZhou" export KEY_ORG="xxx" export KEY_EMAIL="server_monitor@xxx.com" export KEY_OU="YunWei 重新加载 #source ./vars 重新产生CA证书 ./clean-all ./build-ca 创建服务端证书 ./build-key...

Django部署

Django部署   uwsgi配置 官方文档 : uwsgi-docs 选项 描述 chdir the base directory (full path) module Django's wsgi file master 启动管理主进程 processes 启动的进程数 threads 每个进程的线程数 uid 启动uwsgi的用户 gid 启动uwsgi的用户组 pidfile 进程号文件 max-requests 最大请求数 vacuum clear environment on exit 服务停止自动清理sock文件和pid文件 daemonize 日志目录 home python虚拟环境路径 socket scoket地址(tcp或者sock文件路径) chmod-socket sock文件权限 http uwsgi监听IP和端口 x [uwsgi] chdir = /opt/Platform module = Platform.wsgi master = True pidfile = /tmp/tzop.pid vacuum = True max-requests = 5000 processes = 8 #socket=/var/run/op_uwsgi.sock # unxi scoket need set chmod-socket #chmod-socket=666 #socket=127.0.0.1:8000 http = 127 .0.0.1:8000 #static-map = /static=/application/Platform/static daemonize = /opt/Platform/logs/uwsgi.log 启动 x uwsgi --ini tzop.ini 停止 x uwsgi --stop /tmp/tzop.pid 重载 x uwsgi --reload /tmp/tzop.pid nginx配置 uwsgi_pass 不对 location 目录转发 x server {       listen         80 ;       server_name _...