Django ORM中的复选MultiSelectField的使用

下载和介绍: https://pypi.org/project/django-multiselectfield/

在django ORM的使用中,经常会出现选择的情况,例如:

class person(odels.Model):
    sex_type = (('male', '男'), ('female', '女'))
    sex = models.CharField(u"性别", …

解决 invalid 'depends_on macos'

问题

~ brew cask uninstall macdown
Error: Cask 'macdown' definition is invalid: invalid 'depends_on macos' …

最新deepin-wine下微信的安装方法,非常简单 Ubuntu可用

微信最新版本

http://packages.deepin.com/deepin/pool/non-free/d/deepin.com.wechat/

安装脚本

deepin-wine阿里云镜像访问异常,可以使用以下脚本安装最新版deepin-wine

#!/bin/bash
mkdir ./deepintemp
cd ./deepintemp
wget http://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine_2.18-22~rc0_all.deb
wget http://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine32_2.18-22~rc0_i386.deb
wget http://packages.deepin.com/deepin/pool/non-free/d/deepin-wine/deepin-wine32-preloader_2.18-22~rc0_i386.deb …

使用Django admin上传媒体文件至阿里云OSS

设置本地媒体文件,例:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

安装django-aliyun-oss2-storage

pip3 install django-aliyun-oss2-storage

settings.py 添加阿里云OSS配置

# …

Ubuntu18.04中安装virtualenv和virtualenvwrapper

安装python3和pip3

sudo apt-get update
sudo apt install python3
sudo apt install python3-pip

安装virtualenv和virtualenvwrapper

pip3 install …