简体   繁体   English

如何为auth_user模型django添加索引

[英]How to add indexing to auth_user model django

I want to add index to Django built-in table for users which is auth_user. 我想为用户添加指向Django内置表的索引,即auth_user。 I want to add index to first_name of auth_user model. 我想将索引添加到auth_user模型的first_name。

How can i do it? 我该怎么做?

You can create an index directly into the database. 您可以直接在数据库中创建索引。 For example (PostgreSQL): 例如(PostgreSQL):

CREATE INDEX auth_username_idx ON username (auth_user);

It should work. 它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 django 中的用户模型中将“移动”字段添加到默认的 auth_user 表? - How to add 'mobile' field to default auth_user table in User model in django? 我如何使用Django将其他模型字段添加到默认auth_user模型 - How can i add extra model fields to default auth_user model using django 如何更新Standart Django模型(auth_user) - How to update standart Django model (auth_user) 如何在 django postgresql 中向 auth_user 添加列? - How to add columns to auth_user in django postgresql? 如何使用queryset更新django auth_user? - how to update django auth_user with queryset? 如何在Django中使用auth_user模型和cutom模型字段创建自定义注册表单 - How to create custom registration form using auth_user model and cutom model fields in django 在 django 如何自定义 model 管理员以同时保存在 auth_user 和另一个不相关的 model 中? - In django how to customize model admin to save in auth_user and another unrelated model simultaneously? 在Django中创建新表(模型)并将其与auth_user相关 - Creating a New Table (Model) and Relating it to auth_user in Django 如何在 auth_user 表中内置的 Django 中添加一个自定义列 - How to add one custom column in Django built in auth_user table 如何从django中的auth_user表中获取用户ID? - how to get User id from auth_user table in django?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM