如何通过django admin上传

发布于 2024-10-05 02:49:10 字数 387 浏览 0 评论 0原文

    documents = models.FileField(upload_to=settings.FILE_PATH, verbose_name=
_('Attach Your Documents'), help_text=_('.pdf file not exceeding 5 mb.'), 
null=True, blank=True)

通过这种方式,我正在为django admin中的文件的上传创建模型。现在,当有人在 django admin 上单击save 时,我想将此文件上传到 S3。我应该在哪里编写上传到s3的方法。我不明白。

    documents = models.FileField(upload_to=settings.FILE_PATH, verbose_name=
_('Attach Your Documents'), help_text=_('.pdf file not exceeding 5 mb.'), 
null=True, blank=True)

By this way i am creating a models for the upload of a file in django admin. Now I want to upload this file to S3 when some one click save on django admin. Where should i write the methods for uploading to s3. I am not getting any idea.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱冒险 2024-10-12 02:49:11

你可以尝试 django-storages

You could try django-storages

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文