Django CkEditor Series 10 How to host media files on Cloudinary for Django projects

  Рет қаралды 789

Devmaesters

Devmaesters

Күн бұрын

Пікірлер: 5
@Ease_and_Plenty
@Ease_and_Plenty Жыл бұрын
Exactly what I was looking. Say I want a particular field in my model (posts=models.FileField(upload_to='posts') to accept both video and image files, how do I implement this?
@devmaesters
@devmaesters Жыл бұрын
Hi, the code you wrote should work posts=models.FileField(upload _to='posts') Because Filefield is meant to handle different media types.
@Ease_and_Plenty
@Ease_and_Plenty Жыл бұрын
@@devmaesters From the documentation and your tutorial, we must specify the type of file we want to upload to cloudinary using the DEFAULT_FILE_STORAGE variable. Say i set this to the VideoMediaCloudinaryStorage, if i upload an image file on the field example i gave above, it would through an error. Setting the storage=MediaCloudinaryStorage() as an attribute on the field in the model would mean it'll take only image fields right. But what I want is that particular field to upload either image or video files to cloudinary.
@devmaesters
@devmaesters Жыл бұрын
Hi, sorry for replying late. I'll try to use a Field like this in a dummy project today and test it out myself. I will let you know how it goes 👍.
@devmaesters
@devmaesters Жыл бұрын
@jonahebute9135 Check out this post I wrote on how to upload images and videos from the same field in Django devmaesters.com/blog/46
Setting Up CockroachDB in Next js Projects with Prisma ORM
16:54
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
How to Setup Environment Variables for Flask Applications
9:55
Django deployment on Vercel with PostgreSQL database
52:19
Devmaesters
Рет қаралды 2,3 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН