- MediaAsset model with file metadata and AV scan status tracking - ContentBlock model (richtext/image/video/embed/download) with ordered blocks per page and unique constraint on (page, order) - CourseTheme one-to-one per course with primary/secondary color and logo - validate_upload/save_upload helpers with extension and size enforcement - scan_media_asset_task Celery stub (marks clean; replace with ClamAV) - REST API: media upload, page content blocks CRUD, block patch/delete - Admin registrations for all three models - Factory-boy factories and pytest test suite for views, upload, and task Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
904 B
Python
26 lines
904 B
Python
from django.contrib import admin
|
|
|
|
from .models import ContentBlock, CourseTheme, MediaAsset
|
|
|
|
|
|
@admin.register(MediaAsset)
|
|
class MediaAssetAdmin(admin.ModelAdmin):
|
|
list_display = ["file_name", "mime_type", "file_size", "scan_status", "uploaded_by", "created_at"]
|
|
list_filter = ["scan_status", "mime_type"]
|
|
search_fields = ["file_name", "uploaded_by__email"]
|
|
readonly_fields = ["id", "created_at", "scan_status", "scan_result"]
|
|
|
|
|
|
@admin.register(ContentBlock)
|
|
class ContentBlockAdmin(admin.ModelAdmin):
|
|
list_display = ["page", "order", "block_type", "created_at"]
|
|
list_filter = ["block_type"]
|
|
search_fields = ["page__title"]
|
|
readonly_fields = ["id", "created_at", "updated_at"]
|
|
|
|
|
|
@admin.register(CourseTheme)
|
|
class CourseThemeAdmin(admin.ModelAdmin):
|
|
list_display = ["course", "primary_color", "secondary_color", "updated_at"]
|
|
readonly_fields = ["id", "updated_at"]
|