mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-16 19:15:16 +00:00
Add index for looking up User by username
This commit is contained in:
parent
4d5a30d953
commit
0501ce39cd
2 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.2.25 on 2024-04-03 19:14
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("bookwyrm", "0201_keypair_bookwyrm_ke_remote__472927_idx"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name="user",
|
||||||
|
index=models.Index(
|
||||||
|
fields=["username"], name="bookwyrm_us_usernam_b2546d_idx"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -198,6 +198,13 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
hotp_secret = models.CharField(max_length=32, default=None, blank=True, null=True)
|
hotp_secret = models.CharField(max_length=32, default=None, blank=True, null=True)
|
||||||
hotp_count = models.IntegerField(default=0, blank=True, null=True)
|
hotp_count = models.IntegerField(default=0, blank=True, null=True)
|
||||||
|
|
||||||
|
class Meta(AbstractUser.Meta):
|
||||||
|
"""indexes"""
|
||||||
|
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["username"]),
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_follower_requests(self):
|
def active_follower_requests(self):
|
||||||
"""Follow requests from active users"""
|
"""Follow requests from active users"""
|
||||||
|
|
Loading…
Reference in a new issue