Case insensitive unique model fields in Django?

后端 未结 7 2133
我寻月下人不归
我寻月下人不归 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:35

    You can use citext postgres type instead and not bother anymore with any sort of iexact. Just make a note in model that underlying field is case insensitive. Much easier solution.

提交回复
热议问题