Case insensitive unique model fields in Django?

后端 未结 7 2128
我寻月下人不归
我寻月下人不归 2020-12-02 11:23

I have basically a username is unique (case insensitive), but the case matters when displaying as provided by the user.

I have the following requirements:

7条回答
  •  佛祖请我去吃肉
    2020-12-02 11:48

    You can use lookup='iexact' in UniqueValidator on serializer, like this: Unique model field in Django and case sensitivity (postgres)

提交回复
热议问题