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

  Рет қаралды 22,632

BugBytes

BugBytes

Күн бұрын

Пікірлер: 80
@perpy7149
@perpy7149 19 күн бұрын
i dont know English but i can undrestand what you do, thats perfect course , thank you l
@bugbytes3923
@bugbytes3923 16 күн бұрын
Thank you - I'm glad to hear that!
@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!
@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!
@mikedodds9926
@mikedodds9926 6 ай бұрын
great stuff , as always nice and clear , really understandable , these videos are always my go to... thank you
@bugbytes3923
@bugbytes3923 6 ай бұрын
Thanks a lot!
@claytonbennett7797
@claytonbennett7797 3 ай бұрын
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.
@adityanjsg99
@adityanjsg99 24 күн бұрын
Helped me once again... Thank you stallone :)
@bugbytes3923
@bugbytes3923 24 күн бұрын
Awesome haha - thanks!
@padelmaniac
@padelmaniac Жыл бұрын
All of your content is amazing
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot Padel!
@djtoon8412
@djtoon8412 Жыл бұрын
nice one you are really inspiring me in the world of django
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot!
@bartoszjanprzybyszewski1891
@bartoszjanprzybyszewski1891 11 ай бұрын
the dog indeed is amazing
@valentino7057
@valentino7057 Жыл бұрын
so excited for the next video!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot!
@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.
@hardikkalaria159
@hardikkalaria159 Жыл бұрын
Can't wait for the next one!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks!
@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!
@SkeechFab
@SkeechFab Жыл бұрын
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!
@thibaultledanois455
@thibaultledanois455 Жыл бұрын
Perfect tuto for me ! Thank you so much :)
@bugbytes3923
@bugbytes3923 Жыл бұрын
You're welcome - thanks for watching! :)
@stevemulcahy5014
@stevemulcahy5014 5 ай бұрын
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?
@mehdismaeili3743
@mehdismaeili3743 9 ай бұрын
Excellent.
@bugbytes3923
@bugbytes3923 9 ай бұрын
Thank you!
@aafan.kuware
@aafan.kuware 7 ай бұрын
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 8 ай бұрын
Good work. Please show us how to host a website in bluehosy
@tomekklewicki9221
@tomekklewicki9221 Жыл бұрын
So cool!
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thank you for watching!
@DjangoPractice
@DjangoPractice Жыл бұрын
super ❤❤❤❤❤❤ Thank You
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks a lot for watching!
@streamocu2929
@streamocu2929 9 ай бұрын
you are django hero
@bugbytes3923
@bugbytes3923 9 ай бұрын
Thanks a lot 😂
@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?
@vivaldi-qo7xj
@vivaldi-qo7xj Жыл бұрын
Thnx.
@bugbytes3923
@bugbytes3923 Жыл бұрын
You're welcome!
@anthonychianain2241
@anthonychianain2241 Жыл бұрын
Thanks so much
@bugbytes3923
@bugbytes3923 Жыл бұрын
You’re welcome, thanks for the view!
@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.
@satwikawasthi2002
@satwikawasthi2002 10 күн бұрын
Where is front end part for submitting image?
@gibbytravis
@gibbytravis 7 ай бұрын
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?
@JustinSpryce
@JustinSpryce Жыл бұрын
Greate Lesson
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks for watching!
@frameff9073
@frameff9073 Жыл бұрын
Thank you
@bugbytes3923
@bugbytes3923 Жыл бұрын
Thanks!
@yurigorohov9575
@yurigorohov9575 Жыл бұрын
Hello, How can i change text lang for the fileinput?
@ali-cu1ne
@ali-cu1ne 6 ай бұрын
Ammmmmazing content ❤
@bugbytes3923
@bugbytes3923 6 ай бұрын
Thanks so much!
@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 :)
@ayotundeakinwumi8847
@ayotundeakinwumi8847 7 ай бұрын
It upload image to folder but not saving to mysql database. pls kindly asist
@DevendraSingh-ow2xp
@DevendraSingh-ow2xp 6 ай бұрын
Image upload field works in django admin but not working in template (I am not using django forms)
@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.
@ashishbhopte8149
@ashishbhopte8149 7 ай бұрын
Thanks
@alimansimov1929
@alimansimov1929 7 ай бұрын
How to serve in production environment?
@adamfatyga7977
@adamfatyga7977 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@bugbytes3923 I just realized it at the same time :) But thanks a lot for your quick reply.
@JustForFun1426-t4k
@JustForFun1426-t4k 8 ай бұрын
Thank y
@bugbytes3923
@bugbytes3923 8 ай бұрын
Thanks for watching!
@aafan.kuware
@aafan.kuware 7 ай бұрын
28:45 yes, please make it.
@toddgilbey3979
@toddgilbey3979 6 ай бұрын
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.
@YT4ntertainment
@YT4ntertainment 8 ай бұрын
Good Shit.
@bugbytes3923
@bugbytes3923 8 ай бұрын
Cheers!!
@YT4ntertainment
@YT4ntertainment 8 ай бұрын
Can you do a video on ORM relations@@bugbytes3923
@victordavila3642
@victordavila3642 Жыл бұрын
Now I'm afraid to fail
@juampics
@juampics Жыл бұрын
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)
Upload Images To Django - Django Wednesdays #38
14:46
Codemy.com
Рет қаралды 80 М.
Ozoda - Lada ( Official Music Video 2024 )
06:07
Ozoda
Рет қаралды 29 МЛН
🕊️Valera🕊️
00:34
DO$HIK
Рет қаралды 4,5 МЛН
Un coup venu de l’espace 😂😂😂
00:19
Nicocapone
Рет қаралды 10 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 31 МЛН
Python Django Forms tutorial
26:54
Dave Gray
Рет қаралды 10 М.
Python Django Images - How to Upload & Display Images
12:55
Dave Gray
Рет қаралды 13 М.
Implement Amazon S3 Storage for Static and Media files in Django
44:04
Cloud With Django
Рет қаралды 10 М.
Django Update Image Deletion with Signals
21:07
Very Academy
Рет қаралды 1,6 М.
Django Forms - Save Form Data to Database with Model Forms
10:21
Caleb Curry
Рет қаралды 35 М.
How to Upload an Image Using Django ImageField (The RIGHT Way)
20:03
Ozoda - Lada ( Official Music Video 2024 )
06:07
Ozoda
Рет қаралды 29 МЛН