django独特领域 [英] django unique field

查看:165
本文介绍了django独特领域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有另一种REGEX方式(或另一种方式)来确保模型类字段是唯一的? (不是键,或者至少没有声明为键,应该是一个简单的CharField)

is there another REGEX way (or another way) to ensure that a model class field would be unique? (it is not a key, or at least not declared as a key, is shoulb be a simple CharField)

谢谢

推荐答案

使单个字段唯一的正常方法是使用 唯一 字段构造函数的参数。

The normal way to make a single field unique is to use the unique argument to the field constructor.

这篇关于django独特领域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆