方式1: models.xx.objects.filter(Q(id=10)) models.xx.objects.filter(Q(id=10)&Q(age=10) # and models.xx.objects.filter(Q(id=10)|Q(age=10) # or models.xx.o Read More
常用模块导入 1 forms # forms组件的使用 from django import forms 2 ValidationError # modelform报错时使用 from django.core.exceptions import ValidationError 3 mark_safe Read More
import hashlib def gen_md5(origin): """md5加密""" ha = hashlib.md5(b'lkplkp123123') ha.update(origin.encode('utf-8')) return ha.hexdigest() Read More