from sqladmin import ModelView from app.home.models import Image, Project, UserProject class ProjectAdmin(ModelView, model=Project): name = "프로젝트" name_plural = "프로젝트 목록" icon = "fa-solid fa-folder" category = "프로젝트 관리" page_size = 20 column_list = [ "id", "store_name", "region", "task_id", "created_at", ] column_details_list = [ "id", "store_name", "region", "task_id", "detail_region_info", "created_at", ] # 폼(생성/수정)에서 제외 form_excluded_columns = ["created_at", "lyrics", "songs", "videos"] column_searchable_list = [ Project.store_name, Project.region, Project.task_id, ] column_default_sort = (Project.created_at, True) # True: DESC (최신순) column_sortable_list = [ Project.id, Project.store_name, Project.region, Project.created_at, ] column_labels = { "id": "ID", "store_name": "가게명", "region": "지역", "task_id": "작업 ID", "detail_region_info": "상세 지역 정보", "created_at": "생성일시", } class ImageAdmin(ModelView, model=Image): name = "이미지" name_plural = "이미지 목록" icon = "fa-solid fa-image" category = "프로젝트 관리" page_size = 20 column_list = [ "id", "task_id", "img_name", "created_at", ] column_details_list = [ "id", "task_id", "img_name", "img_url", "created_at", ] # 폼(생성/수정)에서 제외 form_excluded_columns = ["created_at"] column_searchable_list = [ Image.task_id, Image.img_name, ] column_default_sort = (Image.created_at, True) # True: DESC (최신순) column_sortable_list = [ Image.id, Image.img_name, Image.created_at, ] column_labels = { "id": "ID", "task_id": "작업 ID", "img_name": "이미지명", "img_url": "이미지 URL", "created_at": "생성일시", } class UserProjectAdmin(ModelView, model=UserProject): name = "사용자-프로젝트" name_plural = "사용자-프로젝트 목록" icon = "fa-solid fa-link" category = "프로젝트 관리" page_size = 20 column_list = [ "id", "user_id", "project_id", ] column_details_list = [ "id", "user_id", "project_id", "user", "project", ] column_searchable_list = [ UserProject.user_id, UserProject.project_id, ] column_sortable_list = [ UserProject.id, UserProject.user_id, UserProject.project_id, ] column_labels = { "id": "ID", "user_id": "사용자 ID", "project_id": "프로젝트 ID", "user": "사용자", "project": "프로젝트", }