Тёмный
No video :(

Django Media Files - Handling User Uploads in Django Forms & Models 

BugBytes
Подписаться 30 тыс.
Просмотров 21 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 75   
@juniorsemerzier660
@juniorsemerzier660 Год назад
great content ! Now we waiting for how to use static files in production.
@bugbytes3923
@bugbytes3923 Год назад
Thanks. Will look into that one in a future topic!
@claytonbennett7797
@claytonbennett7797 Месяц назад
Thanks. I am a Python user, trying to deploy my python project as a web app. Integrating Django with a react frontend has been a new step for me, when it comes to integrating something like dropzonejs. It's nice that your way shows just Django.
@atoprak00
@atoprak00 Год назад
I did use Django clean up module before but learning simply rewriting delete method was good, nice as always and thanks. Next video will be interesting 👍
@bugbytes3923
@bugbytes3923 Год назад
Thanks for watching! Lots of different techniques in Django!
@bartoszjanprzybyszewski1891
@bartoszjanprzybyszewski1891 10 месяцев назад
the dog indeed is amazing
@djtoon8412
@djtoon8412 Год назад
nice one you are really inspiring me in the world of django
@bugbytes3923
@bugbytes3923 Год назад
Thanks a lot!
@padelmaniac
@padelmaniac Год назад
All of your content is amazing
@bugbytes3923
@bugbytes3923 Год назад
Thanks a lot Padel!
@hardikkalaria159
@hardikkalaria159 Год назад
Can't wait for the next one!
@bugbytes3923
@bugbytes3923 Год назад
Thanks!
@dodokwak
@dodokwak Год назад
Great video. Thx. Looking forward to the next. Tried to upload images on S3 (via django -storages) , it works well but I can't delete an uploaded image from the bucket when the "user" wants to delete only the image(partial delete) but not the object (post) entirely.
@bugbytes3923
@bugbytes3923 Год назад
Thank you! Interesting problem, I'll see if I can address that in a future video.
@mikedodds9926
@mikedodds9926 5 месяцев назад
great stuff , as always nice and clear , really understandable , these videos are always my go to... thank you
@bugbytes3923
@bugbytes3923 5 месяцев назад
Thanks a lot!
@valentino7057
@valentino7057 Год назад
so excited for the next video!
@bugbytes3923
@bugbytes3923 Год назад
Thanks a lot!
@raffritter6766
@raffritter6766 Год назад
Can't wait for the next video : )
@bugbytes3923
@bugbytes3923 Год назад
Thanks a lot for watching!
@seydinaoumarsamabaly1806
@seydinaoumarsamabaly1806 Год назад
Very interesting tutorial thank you !
@bugbytes3923
@bugbytes3923 Год назад
Thank you, thanks for watching!
@streamocu2929
@streamocu2929 7 месяцев назад
you are django hero
@bugbytes3923
@bugbytes3923 7 месяцев назад
Thanks a lot 😂
@user-mq6bd2in1u
@user-mq6bd2in1u Год назад
This is so clearly presented 🙏Could you explain how to automatically reduce file size uploaded images?
@bugbytes3923
@bugbytes3923 Год назад
Thank you very much! I can look into that one, along with resizing, in a future video!
@mehdismaeili3743
@mehdismaeili3743 8 месяцев назад
Excellent.
@bugbytes3923
@bugbytes3923 8 месяцев назад
Thank you!
@aafan.kuware
@aafan.kuware 6 месяцев назад
17:42 can you make a dedicated video on how to serve static and media file in production using nginx server, also setting up a contabo object storage instead of aws as contabo is cheap and there's no videos on that.
@JustForFun1426-t4k
@JustForFun1426-t4k 7 месяцев назад
Good work. Please show us how to host a website in bluehosy
@thibaultledanois455
@thibaultledanois455 Год назад
Perfect tuto for me ! Thank you so much :)
@bugbytes3923
@bugbytes3923 Год назад
You're welcome - thanks for watching! :)
@anthonychianain2241
@anthonychianain2241 Год назад
Thanks so much
@bugbytes3923
@bugbytes3923 Год назад
You’re welcome, thanks for the view!
@ali-cu1ne
@ali-cu1ne 5 месяцев назад
Ammmmmazing content ❤
@bugbytes3923
@bugbytes3923 5 месяцев назад
Thanks so much!
@user-mx4fk1eo2f
@user-mx4fk1eo2f Год назад
super ❤❤❤❤❤❤ Thank You
@bugbytes3923
@bugbytes3923 Год назад
Thanks a lot for watching!
@ashishbhopte8149
@ashishbhopte8149 6 месяцев назад
Thanks
@gibbytravis
@gibbytravis 6 месяцев назад
You showed me what not to do in production, but you didn't tell me what I should do in production. How do I server files in a production environment?
@vivaldi-qo7xj
@vivaldi-qo7xj Год назад
Thnx.
@bugbytes3923
@bugbytes3923 Год назад
You're welcome!
@tomekklewicki9221
@tomekklewicki9221 Год назад
So cool!
@bugbytes3923
@bugbytes3923 Год назад
Thank you for watching!
@frameff9073
@frameff9073 Год назад
Thank you
@bugbytes3923
@bugbytes3923 Год назад
Thanks!
@stevemulcahy5014
@stevemulcahy5014 3 месяца назад
What would be a good way to add multiple images to a dog, but not always either needing to add images or to have a limit, like for a gallery for that instance? Would it be making a model called images that has a foreign key to the dog? Then could you have the form for those images on the same creation form as the dog?
@aafan.kuware
@aafan.kuware 6 месяцев назад
28:45 yes, please make it.
@JustinSpryce
@JustinSpryce Год назад
Greate Lesson
@bugbytes3923
@bugbytes3923 Год назад
Thanks for watching!
@ayotundeakinwumi8847
@ayotundeakinwumi8847 5 месяцев назад
It upload image to folder but not saving to mysql database. pls kindly asist
@Septumsempra8818
@Septumsempra8818 Год назад
How do we save the images to a cdn? Eg I want users to upload a profile picture, how do they upload it and it gets converted to an image url on cloudinary?
@DevendraSingh-ow2xp
@DevendraSingh-ow2xp 5 месяцев назад
Image upload field works in django admin but not working in template (I am not using django forms)
@JustForFun1426-t4k
@JustForFun1426-t4k 7 месяцев назад
Thank y
@bugbytes3923
@bugbytes3923 7 месяцев назад
Thanks for watching!
@alimansimov1929
@alimansimov1929 5 месяцев назад
How to serve in production environment?
@yurigorohov9575
@yurigorohov9575 11 месяцев назад
Hello, How can i change text lang for the fileinput?
@zakchips
@zakchips Год назад
Could you please give us some adivise concerning resizing of the uploaded images? I try to do it on the client side (js) but I'm not sure if it's the best option. I do want to check the user's data on my server side for the sake of validation. To resize the uploaded image in the view or in the save method of the model has a risk to create a bottleneck. May be to resize it with lambda function on aws? Thank you in advance.
@bugbytes3923
@bugbytes3923 Год назад
Different ways to do this, you can resize in Django and save to your media storage (perhaps best done in a Celery task, or some asynchronous method). An AWS lambda function would work well if your resources are stored on S3.
@zakchips
@zakchips Год назад
@@bugbytes3923 Thank you. Would it be a problem in an inability to accept images as an argument in celery function. In a view, if form is valid I can bind uploaded file to a model instance, and save it applying resize process in the save method. But it's not the case in celery. Could you make a lesson about it in the feature, please.
@allyouinfotech7936
@allyouinfotech7936 Год назад
i want to store large video files how i link cloud storage with django models
@bugbytes3923
@bugbytes3923 Год назад
Use a FileField with django-storages to link the video to its cloud location.
@toddgilbey3979
@toddgilbey3979 5 месяцев назад
I am absolutely seething right now, Why do I just keep getting the "Could not find config for 'default' in settings.STORAGES." Absolutely stupid situation.
@TomislavMiletic
@TomislavMiletic Год назад
Thank you! Okay so i have an image field model with a default value "default=default-images/category.jpg" so that each new category can have something set if a user doesn't upload an image rightaway. But the problem occures when i test and delete the category. Now that default image gets deleted, so each new category that is created without an image, now has that empty value. Is there a workaround, but without doing it conditionally in the template?
@bugbytes3923
@bugbytes3923 Год назад
If I understand correctly - On the backend, you can prevent the deletion of the default image within the model's delete() function. In that function, check if the model that you're deleting has the image-field's filename set to that default image, and avoid deleting the file if so (you can still remove the category itself, of course). Otherwise, if NOT the default, you can then delete that file, as well as the model.
@TomislavMiletic
@TomislavMiletic Год назад
@@bugbytes3923 Thank you, i will try that :)
@YT4ntertainment
@YT4ntertainment 6 месяцев назад
Good Shit.
@bugbytes3923
@bugbytes3923 6 месяцев назад
Cheers!!
@YT4ntertainment
@YT4ntertainment 6 месяцев назад
Can you do a video on ORM relations@@bugbytes3923
@adamfatyga7977
@adamfatyga7977 11 месяцев назад
I dont know why, when i want to runserver at 6:40 i have error: from forms import DogForm ModuleNotFoundError: No module named 'forms'
@bugbytes3923
@bugbytes3923 11 месяцев назад
Try: from .forms import DogForm Note the dot in from of forms: .forms To tell django the forms module is in the current app
@adamfatyga7977
@adamfatyga7977 11 месяцев назад
@@bugbytes3923 I just realized it at the same time :) But thanks a lot for your quick reply.
@victordavila3642
@victordavila3642 Год назад
Now I'm afraid to fail
@juampics
@juampics 10 месяцев назад
good video, it was quite helpful. I was looking for how to delete the /media/ files but when the avatar in the profile is updated. In case it helps anyone, do it like this: def save(self, *args, **kwargs): # Delete the old file before saving the new one try: this = Avatar.objects.get(id=self.id) if this.image != self.image: this.image.delete(save=False) except Avatar.DoesNotExist: pass super(Avatar, self).save(*args, **kwargs)
Далее
Python Django Images - How to Upload & Display Images
12:55
3d printed demon core vs real
00:24
Просмотров 6 млн
when you have plan B 😂
00:11
Просмотров 5 млн
How to get Spongebob El Primo FOR FREE!
01:36
Просмотров 13 млн
Search Products - Django Wednesdays ECommerce 26
21:05
Просмотров 4,2 тыс.
Django 5.0 Just Made Forms Even Better
3:24
Просмотров 11 тыс.
4 ways to serve static files in Django
8:11
Просмотров 11 тыс.
Brutally honest advice for new .NET Web Developers
7:19
Django Forms: File Field
12:57
Просмотров 1,1 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 356 тыс.
Configure Static & Media Files in Django | Python
11:10
3d printed demon core vs real
00:24
Просмотров 6 млн