ปกติเราทำการเปลี่ยนแปลงไฟล์/รูปภาพจาก Frontend บทความนี้สอนจัดการไฟล์ที่ Admin Panel จัดการไฟล์ประเภทต่างๆ ที่จะ render จาก Server ไป Client
ตัวอย่าง
ติดตั้ง django-filer:
pip install django-filer
ใน settings.py:
INSTALLED_APPS = [
...
'easy_thumbnails',
'filer',
'mptt',
...
]
THUMBNAIL_HIGH_RESOLUTION = True
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
เพิ่มไลบรารีที่จำเป็นเป็นแอป ตั้งค่า image pre-processing
ใน urls.py:
urlpatterns = [
...
path(r'filer/', include('filer.urls')),
...
]
สร้าง URL สำหรับ File Manager เก็บไฟล์/รูปภาพ
เอาต์พุต

สำหรับ conical URL ไปที่โฟลเดอร์ จะมีปุ่ม กดแล้วได้ conical URL:
