-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add handle<>workspace connection to admin pages
- Loading branch information
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
from django.contrib import admin | ||
|
||
from app_users.admin import AppUserAdmin | ||
from workspaces.admin import WorkspaceAdmin | ||
from .models import Handle | ||
|
||
|
||
@admin.register(Handle) | ||
class HandleAdmin(admin.ModelAdmin): | ||
search_fields = ["name", "redirect_url"] + [ | ||
f"user__{field}" for field in AppUserAdmin.search_fields | ||
] | ||
readonly_fields = ["user", "created_at", "updated_at"] | ||
search_fields = ( | ||
["name", "redirect_url"] | ||
+ [f"user__{field}" for field in AppUserAdmin.search_fields] | ||
+ [f"workspace__{field}" for field in WorkspaceAdmin.search_fields] | ||
) | ||
readonly_fields = ["user", "workspace", "created_at", "updated_at"] | ||
|
||
list_filter = [ | ||
("user", admin.EmptyFieldListFilter), | ||
("workspace", admin.EmptyFieldListFilter), | ||
("redirect_url", admin.EmptyFieldListFilter), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters