forked from GithubBackups/healthchecks
Expose Credentials model in Django admin
This is to help troubleshoot 2FA issues without running manual SQL queries.
This commit is contained in:
parent
52e1d420b5
commit
8a154cbaf5
@ -6,7 +6,7 @@ from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from hc.accounts.models import Profile, Project
|
||||
from hc.accounts.models import Credential, Profile, Project
|
||||
|
||||
|
||||
@mark_safe
|
||||
@ -71,7 +71,7 @@ class TeamFieldset(Fieldset):
|
||||
|
||||
|
||||
class NumChecksFilter(admin.SimpleListFilter):
|
||||
title = "Checks"
|
||||
title = "check count"
|
||||
|
||||
parameter_name = "num_checks"
|
||||
|
||||
@ -116,9 +116,10 @@ class ProfileAdmin(admin.ModelAdmin):
|
||||
list_filter = (
|
||||
"user__date_joined",
|
||||
"last_active_date",
|
||||
"reports_allowed",
|
||||
"reports",
|
||||
"check_limit",
|
||||
NumChecksFilter,
|
||||
"theme",
|
||||
)
|
||||
|
||||
fieldsets = (ProfileFieldset.tuple(), TeamFieldset.tuple())
|
||||
@ -244,3 +245,13 @@ class HcUserAdmin(UserAdmin):
|
||||
|
||||
admin.site.unregister(User)
|
||||
admin.site.register(User, HcUserAdmin)
|
||||
|
||||
|
||||
@admin.register(Credential)
|
||||
class CredentialAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "created", "email", "name")
|
||||
search_fields = ["id", "code", "name", "user__email"]
|
||||
list_filter = ["created"]
|
||||
|
||||
def email(self, obj):
|
||||
return obj.user.email
|
||||
|
Loading…
x
Reference in New Issue
Block a user