加入「拾匣」:密码保护的私有文件柜
- 新增 cabinet 应用:Folder / StoredFile 及迁移 - 浏览公开;下载、新建目录、上传需要密码解锁(session 120 分钟) - 文件存放在 MEDIA_ROOT 之外的 storage/,下载必须经过视图鉴权 - 支持多级目录、文件名清洗、重名自动编号、分批上传与进度 - 页面:分类卡片、面包屑、文件行点击下载、上传进度、密码弹窗 - 修复弹窗命中测试:浮层移到 body、提升 z-index、去掉模糊与位移动画 - 首页新增「拾匣」入口
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Folder, StoredFile
|
||||
|
||||
|
||||
@admin.register(Folder)
|
||||
class FolderAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "name", "parent", "file_count", "created_at")
|
||||
search_fields = ("name",)
|
||||
list_filter = ("created_at",)
|
||||
|
||||
@admin.display(description="文件数")
|
||||
def file_count(self, obj):
|
||||
return obj.files.count()
|
||||
|
||||
|
||||
@admin.register(StoredFile)
|
||||
class StoredFileAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "name", "folder", "size", "uploaded_at", "download_count")
|
||||
search_fields = ("name",)
|
||||
list_filter = ("uploaded_at", "folder")
|
||||
readonly_fields = ("stored_path", "size", "content_type", "uploaded_at", "download_count")
|
||||
Reference in New Issue
Block a user