#169 Team delete-restore
* adds restorable delete functionality to Team model * refactors minor code model parts by introducing DeletableObjectMixin * only non-deleted Teams can be chosen for sharing * deleted Teams can be restored using the proper function on the backend admin * deleted Teams do not provide * adds migration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from user.models import UserNotification, UserActionLogEntry, User, Team
|
||||
from konova.admin import DeletableObjectMixinAdmin
|
||||
from user.models import User, Team
|
||||
|
||||
|
||||
class UserNotificationAdmin(admin.ModelAdmin):
|
||||
@@ -64,10 +65,11 @@ class UserActionLogEntryAdmin(admin.ModelAdmin):
|
||||
]
|
||||
|
||||
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
class TeamAdmin(DeletableObjectMixinAdmin, admin.ModelAdmin):
|
||||
list_display = [
|
||||
"name",
|
||||
"description",
|
||||
"deleted",
|
||||
]
|
||||
search_fields = [
|
||||
"name",
|
||||
@@ -78,6 +80,13 @@ class TeamAdmin(admin.ModelAdmin):
|
||||
"admins",
|
||||
]
|
||||
|
||||
readonly_fields = [
|
||||
"deleted"
|
||||
]
|
||||
|
||||
actions = [
|
||||
"restore_deleted_data"
|
||||
]
|
||||
|
||||
admin.site.register(User, UserAdmin)
|
||||
admin.site.register(Team, TeamAdmin)
|
||||
|
||||
Reference in New Issue
Block a user