【发布时间】:2021-02-08 08:28:36
【问题描述】:
我使用 Angular 作为前端范围,使用 Django Rest 作为后端。现在我面临一个想要创建模型的情况。模型的结构本质上非常复杂,我可以使用其他一些简单的方法,但使用 JSON 并传递文件可以真正简化逻辑并让流程变得非常高效。
我已经尝试了很多,但似乎没有一种方法有效。
有人可以用标准方式帮助我,或者告诉我是否可能。
这是我要上传的 Typescript 的结构。
import { v4 as uuid4 } from 'uuid';
export interface CompleteReport{
title: string;
description: string;
author: string;
article_upload_images: Array<uuid4>,
presentation_upload_images: Array<uuid4>,
report_article: ReportArticle,
report_image: ReportImage,
report_podcast: ReportPodcast,
report_presentation: ReportPresentation,
report_video: ReportVideo,
}
export interface ReportArticle{
file: File;
body: string;
}
export interface ReportPodcast{
file: any;
}
export interface ReportVideo{
file: Array<File>;
}
export interface ReportImage{
file: File;
body: string;
}
export interface ReportPresentation{
body: string;
}
export interface UploadImage{
file: File;
}
【问题讨论】:
标签: python django angular typescript django-rest-framework