Skip to content

Commit

Permalink
Update admin panel for users app
Browse files Browse the repository at this point in the history
  • Loading branch information
EXG1O committed Sep 14, 2024
1 parent 0929521 commit 7ae421f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UserAdmin(admin.ModelAdmin[User]):
'telegram_id',
'first_name',
'last_name',
'telegram_bots_count',
'telegram_bot_count',
'is_staff',
'last_login',
'joined_date',
Expand All @@ -30,7 +30,7 @@ class UserAdmin(admin.ModelAdmin[User]):
'last_name',
'confirm_code',
'confirm_code_generation_date',
'telegram_bots_count',
'telegram_bot_count',
'groups',
'is_staff',
'last_login',
Expand All @@ -43,7 +43,7 @@ class UserAdmin(admin.ModelAdmin[User]):
'last_name',
'confirm_code',
'confirm_code_generation_date',
'telegram_bots_count',
'telegram_bot_count',
'last_login',
'joined_date',
]
Expand All @@ -52,11 +52,11 @@ def get_queryset(self, request: HttpRequest) -> QuerySet[User]:
return (
super()
.get_queryset(request)
.annotate(telegram_bots_count=Count('telegram_bots'))
.annotate(telegram_bot_count=Count('telegram_bots'))
)

@admin.display(description=_('Telegram ботов'), ordering='telegram_bots_count')
def telegram_bots_count(self, user: User) -> int:
@admin.display(description=_('Telegram ботов'), ordering='telegram_bot_count')
def telegram_bot_count(self, user: User) -> int:
return user.telegram_bots.count()

@admin.action(
Expand Down

0 comments on commit 7ae421f

Please sign in to comment.