There is an issue with the code in this video that I fixed in the later videos. If you're getting an error that says something like "save() got an unexpected keyword argument 'force_insert'" then please update the save method in users/models.py to the following: def save(self, *args, **kwargs): super().save(*args, **kwargs)
@jstone1cougar6 жыл бұрын
@21:05 files from my photos on my mac were 180 askew so: img.rotate(180)
@anneest6 жыл бұрын
Ah thanks, I got this error and I was going to comment here. Now it works smoothly. Great! :-)
@arfin976 жыл бұрын
Can you please tell me how do I stop saving duplicate images with new name? If an image I'm uploading is from the same user, it will delete the previous image of the user and save the new one. How can I do that? Btw, thanks for such awesome tutorials :)
@varunmahanot57666 жыл бұрын
all of my flash messages are going to the admin page
@Tedraketje6 жыл бұрын
@@jstone1cougar same problem but then 90degrees to the right. but img.rotate(-90) doesn't seem to do anything. I pasted my code here. if img.height > 500 or img.width > 500: output_size = (500, 500) img.thumbnail(output_size) img.rotate(-90) img.save(self.image.path)
@sambegstha12415 жыл бұрын
That enctype at 6:45 screwed me up real good for 4 days trying to debug the program. I'm glad Corey pointed it out. Thanks Corey.
@ChristopherGeorge19645 жыл бұрын
Been involved in software development for over 30 years and wanting to "build again" on my own and I have to say these tutorials are really awesome!
@martianmatt3923 жыл бұрын
This series is incredible, thank you Corey :) I think the enctype thing at 7:35 needs a special emphasis. I spent 30 minutes trying to figure out why the username and email updated fine, but the image wouldn't. Putting this here to hopefully save someone the headache.
@shubhamsirothiya25513 жыл бұрын
My image is not updating
@ebvogt1112 жыл бұрын
@@shubhamsirothiya2551 ensure to be using correct file format (.jpg) and not some random PDF or something.
@ninonazghaidze76875 жыл бұрын
The dog in the picture is the loveliest
@erwinnovo3014Ай бұрын
These videos just keep on getting better and better! Kudos, Corey!
@letsfixedit5722 жыл бұрын
I was trying to make a change to my website. For the last 5 days, I have just wanted to add an image field in my blog, but when I tried to update my Image it won't change today I saw at 7:33 that I want to add an enctype in the form tag. I applied that changes in my HTML file and it works. Thanks a lot, Corey Schefar
@shashanksharma72424 жыл бұрын
Corey is so amazing, he anticipates the sections where you could make a mistake. For me I misspelled 'multipart' to mutipart and there was no error but the uploaded image wasn't getting updated. Got back to video and found out he advised about the same trap.
@daphinebabu46143 жыл бұрын
couldn't agree with you more.. corey is incredible!
@nmoore19883 жыл бұрын
Just made the same mistake, thanks for this comment, made me look again.... I mistyped and ended up with 'ecntype'
@vp90416 жыл бұрын
For blog author image, I just copied the line from users/profile.html and changed the class from account-img to article-img, that too worked. Thanks great explanation
@thewordforever48395 жыл бұрын
No that doesn't work. It will always show the picture of the user who is logged in, not the actual author of the post
@sahilbisht36614 жыл бұрын
best teacher ever . dude you explained every little thing so clearly !! love from india
@zeroXverse5 жыл бұрын
16:40 The Highlight of my morning. Thank you
@yehonatan3000 Жыл бұрын
Corey, you're a legend, thank you so much! Just a small thing that can help; maybe it will be better if you'll use keyword arguments more often because it helps clarify what is the meaning of every argument we pass. For instance, in the profile function inside the views.py module, we can also write it like this: def profile(request): # u_form = user_form, p_form = profile_form if request.method == 'POST': u_form = UserUpdateForm(data=request.Post, instance=request.user) p_form = ProfileUpdateForm(data=request.Post, files=request.FILES, instance=request.user.profile) else: u_form = UserUpdateForm(instance=request.user) p_form = ProfileUpdateForm(instance=request.user.profile) And then it is much more readable.
@theinnoverse4 жыл бұрын
I have completed this part too , really good explanation, now i just have few videos remaining, also i'm coding along, so it's a great experience
@ThienNguyen-up3ks4 жыл бұрын
have u get a programming job?
@theinnoverse4 жыл бұрын
@@ThienNguyen-up3ks nope it's hard in lockdown, I'm looking for a job
@waqasmushtaq814 жыл бұрын
This is the most useful tutorial I encountered while learning Django. Excellent stuff. 1 small suggestion for the above lesson: Instead of having this twice in views.py: u_form = UserUpdateForm( instance=request.user ) (for GET) u_form = UserUpdateForm( request.POST, instance=request.user ) (for POST) This can be done in 1 line like this: u_form = UserUpdateForm(request.POST or None, instance=request.user)
@dennischirchir54615 жыл бұрын
You are The G.O.A.T. ...Your explanation is inch-perfect
@tyler-taewook3 жыл бұрын
If your form is working fine but the image isn't being updated, make sure to check you haven't misspelled anything from [enctype="multipart/form-data"] in .html file! I made a typo here which caused the exact same problem, which seems many have also encountered in this comment section
@alimoradi8490 Жыл бұрын
Thanks bro😂😂😂😂
@TimLin-ui7kp11 ай бұрын
thank you
@friendlychannel1004 жыл бұрын
i am on tutorial 9 and realised i am not a sub yet!... Thank you for this amazing series so far... i went through lots of tutorials but none of them go the ways you do. 💕 will support you when i am able to ✌
@adaymunizrosas94864 жыл бұрын
How proud can one be of his dog? I do the same with mine xD
@ishankamboj35224 жыл бұрын
You are the best teacher for django out there. You teach professionally 👍👍
@ronnymokaya6124 Жыл бұрын
If you're having an issue resizing the image and getting the error Image is not defined, you can try import pillow library "from PIL import Image" and it will work right.
@AstronautKanojo10 ай бұрын
You have saved me from failing this class 😭 Subbing for sure, thank you
@callmeetc9 ай бұрын
Using this tutorial to catch up with Django for a School Project.. hahaha even with the depricated methods by post date Django 5.0, I still love the learning path and word choice for explanation.. THumBs Up
@mr.anderson53934 жыл бұрын
I have to say thank you very much for the great tutorial. I recreated users app and watched part 6-8 several times, and finally able to do parts 6-8 without watching the tutorial. However, part 6-8 is not a joke- I studied basic OOP, but not like this. Luckly, Mr. Schafer, sir you have explained thigs pretty well for me to understand. Once again great tutorial and thank you very much.
@callmeetc9 ай бұрын
Hahaha, kept on getting the logour error and got stuck through the very same episodes two day in a row now.... now we off to 9
@mr.anderson53939 ай бұрын
@@callmeetc you cool now?
@ksjempire19575 жыл бұрын
You must get a lot of watchtime from these you deserve all those minutes and more
@thetruereality24 жыл бұрын
Hi Corey, I have been following your tutorials from the beginning and I understand your explanation quite well. Thank you very much for posting these videos.
@Sirreal455 жыл бұрын
Corey is great...however, in this video he's using square images to make those perfect circle avatar thumbnails. If you try a non-square image, it will looked kind of skewed. if you want to resize by middle crop to his dimensions. use this... in models.py import an additional Pillow function: From PIL import Image,ImageOps then later in the function def save if img.height > 300 or img.width > 300: output_size = (300, 300) resized = ImageOps.fit(img, output_size, Image.ANTIALIAS) resized.save(self.image.path) this basically crops the image to 300x300 square so that the circle bootstrap and css he provided work.
@dcdemeoАй бұрын
Five years later, Image.ANTIALIAS is deprecated. Use Image.LANCZOS instead.
@ΠΑΝΟΣΚΩΣΤΟΠΟΥΛΟΣ-η3χ5 ай бұрын
there is a mistake here i think. the signals interfere with the views and the save method from Profile is called twice when updating the profile(you can check it yourselves by putting a print statement) i fixed by by removing the 2nd signal save_profile as the save method is always being called from the views. also the overrided method needs args and kwargs because the parent function (super) needs them to function.
@kristiyanpenev18202 жыл бұрын
Mr. Corey, you are simple THE BEST!
@djudsod9594 жыл бұрын
16:30 the dog is adorable. Instantly Paused the tutorial to mention this.
@bunchathumbs61943 жыл бұрын
If ur watching this course and you are beginner I would recommend you to start with learning Flask first. Yeah Django is amazing but to much stuff if working out of the box. P.S. Tutorial is great!
@jacobshore5 жыл бұрын
Hi, thanks for these videos, they're great! Quick question/clarification: the reason we were able to access the image from the homepage via {{ post.author.profile.image.url }} is because the author column of the post table is a foreign key to the user username table as set in the blog app models + the profile has a one to one relationship with the the user table as set in the user app models - right? It seems kind of intuitive, but I'm looking through the docs to see what would work with this and what wouldn't and I get the sense that in the other frameworks I've experienced (mostly PHP ones like Laravel, Symphony, Yii + Flask) one would have to be much more explicit about these connections - but maybe it's just intuitive b/c you're so smooth and make it seem so obvious. If you, or anyone reading this, could lead me the right documentation, I'd greatly appreciate it.
@junecnol794 жыл бұрын
10:25 ModelForm 기존의 model의 이용하여 form 만들기 docs.djangoproject.com/en/3.0/topics/forms/modelforms/#modelform 11:30 HttpRequest.POST 안에 사용자가 입력한 form data가 들어있다. docs.djangoproject.com/en/3.0/ref/request-response/#django.http.HttpRequest.POST 12:15 HttpRequest.FILES 12:50 multi form validation 17:29 resizing image with pillow 18:25 Model.save() docs.djangoproject.com/en/3.0/ref/models/instances/#saving-objects 24:50 bootstrap rounded-circle article-img
@bowenwang6 жыл бұрын
Too great to stop watching.
@OmarSanchez-ds4qh6 жыл бұрын
started at 11AM and its 4AM now. just too good.
@boryskuczkowski6 жыл бұрын
Hey Corey, after testing the app, I encountered the problem while trying to register new user - save() got an unexpected keyword argument 'force_insert'. I came around it by adding **kwargs into the Profile save function: def save(self, **kwargs): super().save() img = Image.open(self.image.path) if img.height > 300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path) Is that ok in your opinion?
@mishatet89116 жыл бұрын
That was actually my case. So, thanks for the tip.
@dikdikoobraz28756 жыл бұрын
I had the same problem
@daksh_sagar6 жыл бұрын
Signature of the base method in class Model is save(self, **kwargs) and method overriding it should have the same signature, so adding **kwargs as an argument to save makes sense.
@nasalee37296 жыл бұрын
I have the same issue too, and this solved the problem!!
@azamuray6 жыл бұрын
Thank you
@htfihottopicfeed97343 жыл бұрын
Words can't explain how much i want to thank you for this awsome tutorial
@JayaPrakash-io2re5 жыл бұрын
Thank you so much Corey Schafer for your Tutorials ....its really really Helping me ..No words to describe it
@banaras.wala.foreignaala4 жыл бұрын
Hi Corey, So far so good, you explained it very well, thanks
@pipinstallpython6 жыл бұрын
I'm in love with your coding, thanks for the quality videos so much useful information.
@roba_mutua5 жыл бұрын
Great tutorial. In the resizing of the images, how about instead of overwriting the save method, we resize the image before committing the form? Something like: if profile_picture_form.is_valid(): instance = profile_picture_form.save(commit=False) img = Image.open(instance.profile_picture.path) if img.height > 400 or img.width > 400: output_size = (400, 400) img.thumbnail(output_size) img.save(instance.profile_picture.path) instance.save()
@pawanchhangani75285 жыл бұрын
You are awesome ❣️ my friend. Love from India
@mihaly-wm9tb Жыл бұрын
After resizing the image, it is rotated 90 degrees anticlockwise. To fix that, one can use the built-in rotate method of the Image class in the pillow package. See below code with rotate() being applied to the resized image. if img.height > 300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img = img.rotate(-90) img.save(self.image.path)
@hidayathidayat44693 жыл бұрын
can't believe this is free on youtube
@mdminhajulislammahin95103 жыл бұрын
Awesome Tutorial Thanks Sir. Take love from Bangladesh
@PradeepKumar-ps4cs Жыл бұрын
I wasn't able to make crispy forms work my django so I removed crispy tags and all crispy references. On profile page, I can see image, username and email but u_form and p_form (input fields) are not showing up in the browser. Yes, {{ u_form }} and {{ p_form }} are included on profile.html
@PradeepKumar-ps4cs Жыл бұрын
I found the issue, I didnt add context to the render in the last line. After adding ut worked. I compared Corey's code and mone line by line.
@toastrecon5 жыл бұрын
Another great one. Thanks, Corey!
@moebazzi84126 жыл бұрын
AMAZING AND CLEAR TUTORIALS WELL DONE COREY!!!
@congcuongnguyen4132 жыл бұрын
0:25 - form to update profile 3:28 - view to update profile 4:54 - template 7:13 - enctype attribute 9:20 - model form 11:11 - pass in POST data 16:41 - auto resize image 23:27 - display author image in post
@sabmost2 жыл бұрын
Pls send the source
@yongxuanch29304 жыл бұрын
hello there corey, you're videos are amazing, I just want to let you know that after I followed the video my accounts suddenly went wrong so I just want to say that I added this code : def save(self, *args, **kwargs): super(Profile, self).save(*args, **kwargs) img = Image.open(self.image.path) if img.height > 300 or img.width > 300: output_size = (300,300) img.thumbnail(output_size) img.save(self.image.path)' and everything went totally fine.
@RebeccaBrunner6 жыл бұрын
Great series so far, thorough but simple.
@AlwarrenSidh6 жыл бұрын
Great video series, I am thoroughly enjoying this.
@zebusaqua44152 жыл бұрын
updated save function with delete included. Also does not accidentally delete the default.jpg image def save(self, *args, **kwargs): try: this = Profile.objects.get(id=self.id) if this.image == 'default.jpg': pass elif this.image != self.image: this.image.delete(save=False) except: pass super(Profile, self).save(*args, **kwargs) img = Image.open(self.image.path) if img.height > 300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path)
@arcadioabrahamherreraabril76063 жыл бұрын
That is an incredible content! Greetings from Spain
@romann_shr Жыл бұрын
VS code is more convenient to me than sublime text since it shows the related functions while typing, so we don't make any typos
@xvegandersx6 жыл бұрын
First of all, great tutorials, I've been binge-watching them since this morning. Secondly, I've run into a really weird bug or behavior I do not understand when resizing the images. At first my images wasn't being resized properly so I sprinkled some logging in the save function of the Profile class. Just before the if-statement I logged both img.width as well as self.image.width and the two differed, with the former set to the limit of 300, while the latter had the original size. I then continued to add more logging and added an else statement to make it something like this: needs_resize = img.width > 300 or img.height > 300 logger.error(f'{img.width}x{img.height} {needs_resize}') logger.error(f'{self.image.width}x{self.image.height}') if needs_resize: logger.error("In resize before work") output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path) logger.error("In resize after work") else: logger.error("No resize needed") The weird thing is that as the above is written, I will get this output: 190x300 False 515x812 No resize needed If I on the other hand comment out the line img.save(self.image.path) I will get this output: 515x812 True 515x812 In resize before work In resize after work Any clue on what's going on? It seems like the img.save function gets called before the if-statement is evaluated somehow.
@xvegandersx6 жыл бұрын
I should just add that the resizing seems to work, but the logging is still incorrect
@taoufikb5975 жыл бұрын
@@xvegandersx super().save() ?
@anatoliyloboda46015 ай бұрын
Thank you Corey! But it turns out the small issue. If default imange is updated it is saved into media/profile_pick. So if a user updates their profile multiple times, the old images won't be deleted and the save capacity won't be vacant
@GCKteamKrispy Жыл бұрын
Hey guys. I am very confused on this question: why do we register and update users AND profile? Aren't they same?
@ingafter63353 жыл бұрын
Hi Corey, Many-many thanks for this great and practical tutorials. I have learned a lot from this tutorials. About resizing the image, please advise me to learn more about it. Thanks. Nyoman, from Bali, Indonesia
@lightflix5 жыл бұрын
Hey Corey, your tutorials are great!! The images are not proportional inside the circle so how can we fix that? If I upload an image that's not equal in height and width, it gets stretched. Thank you
@austinpena78595 жыл бұрын
object-fit CSS rule
@ModularPilotJack2 жыл бұрын
If you're watching this in 2022, go profile.html, in the first img class (where profile url is linked) add style="border-radius= 50%" before src="". That will make it a circle :) edit: to make it look less stretched, make sure the HTML class points to the css div account-image
@banaras.wala.foreignaala4 жыл бұрын
Oh my god, super().save() this is really super Awesome. So far so good. Thanks
@georgedikas7327 Жыл бұрын
Hello Corey! Why did you write self.image.path instead of writing self.image.url within overriden save method? Thank you in advance!
@Rahul-ut9rd3 жыл бұрын
We actually don't need to add email field explicitly in UserUpdateForm. As User model already has an email field. We can convert email field from User to model to form field just like username field
@bringinglife24 жыл бұрын
This is just excellent! Thanks a lot for the content!
@wladimirovff4 жыл бұрын
Thanks a lot for the course, it's amazing , you are really a good teacher :-D
@WajidAli-mf2yk5 жыл бұрын
Hi, Corey, This is an amazing series. I really want to change my tech stack. ( from java to python)
@danielflorez37622 жыл бұрын
Please, dont. Django is so f-ing complicated.
@LukaReeson3 жыл бұрын
For anyone how wants to delete the old profile image when you upload a new one: 1. pip install django-cleanup 2. in settings.py INSTALLED_APPS = ( ... 'django_cleanup', # should go after your apps )
@arturofm6 жыл бұрын
around minute 4:40 your speed was like looool jajajaj I had to pause the video like 5 times :D
@coreyms6 жыл бұрын
Haha. You can set the speed to 0.75 if it helps.
@tipstoeveryoneblogspot29894 жыл бұрын
I got this error when I try to access the admin page: RelatedObjectDoesNotExist at /admin/login/ after doing bit research found solution as below.: file: users/signals.py from django.core.exceptions import ObjectDoesNotExist @receiver(post_save, sender=User) def create_profile(sender, instance, created, **kwargs): try: instance.profile.save() except ObjectDoesNotExist: Profile.objects.create(user=instance)
@vladusa4 жыл бұрын
its already correct for everyone
@nihal22524 жыл бұрын
Thank you @tipstoeveryone blogpost. Even StackOverflow was not able to solve my problem. :p Thanks a lot.
@sripriyar39164 жыл бұрын
Dude thank you very much!! Had a prob with class based update view so had to use Post function in my CBV !
@kiranraj-dw5gq5 жыл бұрын
Thanks Corey.Awesome Tuts
@JohnDoeJr1236 ай бұрын
At 15:47 I had an interesting error. When trying to login as admin to /admin I had 'user profile does not exist' error. As a solution I had to manually insert record about admin to users_profile table with values for id, image, user_id columns.
@ildar_eto_ya2 жыл бұрын
Really love it!
@nickwinnenberg91094 жыл бұрын
That's a really, really cute puppy.
@sumit1802884 жыл бұрын
If I put an existing username while updating profile page, then {{ user.username }} is showing incorrect value in profile.html, even though save() is not called. Can you please help with that.
@jeisaraja98513 жыл бұрын
Yes i need help on this too
@vicentemanriquez51665 жыл бұрын
Any one have problems with crispy and profile form ? i don´t have the same button to upload the image and dont show the previous url image, help :C
@tomatoft.022 жыл бұрын
Great tutorial, but i don't understand where profile is in request.user.profile at 10:28
@bishalgautam38746 жыл бұрын
Great tutor! Keep making such videos
@ishantiwarimusic4 жыл бұрын
Which laptop do you use
@briansf249 ай бұрын
Is email = forms.EmailField() required in the UserUpdateForm class? I understand why we included it in UserRegisterForm - email isn't a default field in UserCreationForm. But seems like we're not modifying the behavior of the email field in any way so the Meta class definition should be enough so long as we include both username and email?
@sinmiakindele2665 жыл бұрын
Thank you so much for your videos, they have been so helpful in my understanding of django. I was wondering if you can help me with debugging, anytime I log in with a new user and try to access his profile, i get this error message; "RelatedObjectsDoesNotExist at /profile/" but I'm able to access profile with only the first two test users that I created, I get that error message with other test users.
@stasczekalski34366 жыл бұрын
I was having an issue of not seeing authors' profile pictures next to their posts. It turned out the posts were created by users for which I havn't uploaded pictures (and they havn't been uploaded by default, because these users were created before loading default image functionality had been implemented). Be careful not to make the same mistake I did!
@gyappumusoka40165 жыл бұрын
I literally just had the same problem now! I came here to look for answers and here you came. Thanks! I haven't even paid attention to that.
@xintongliu80684 жыл бұрын
1. create update userform and update profile form to the profile page. 2. resize oversize imported ing. 3. add author's img to the post.
@manikndn86 жыл бұрын
Wonderful Corey!
@shashwatpandey35564 жыл бұрын
I followed up till 8:30 and then I checked up on my server it was fine too but when loaded the profile page from the site it showed an error and said "ModelForm has no model class specified. " pls anyone Help ME out...
@sos22714 жыл бұрын
change meta to Meta in forms.py
@shashwatpandey35564 жыл бұрын
@@sos2271 did that but the code failed...
@shashwatpandey35564 жыл бұрын
@@sos2271 Exception has occurred: ImproperlyConfigured Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form ProfileUpdateForm needs updating. File "C:\Users\VC\Documents\practice\Schaffer\ODIN\users\forms.py", line 22, in class ProfileUpdateForm(ModelForm): File "C:\Users\VC\Documents\practice\Schaffer\ODIN\users\views.py", line 4, in from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm File "C:\Users\VC\Documents\practice\Schaffer\ODIN\ODIN\urls.py", line 19, in from users import views as users_views I used the Django debugger and that's what it said.
@sos22714 жыл бұрын
@@shashwatpandey3556 i think you missed something restart video and watch it step by step , i had the same probleme at the first but when i changed meta to Meta it worked
@shashwatpandey35564 жыл бұрын
@@sos2271 possibly
@stephendocherty1203 Жыл бұрын
Loving these tutorials, thank you so much! Noticed a couple of issues with this one however. Fistly, when uploading some image files after implementing the resizing method, it is rotating image through 90 degrees. Also noticed that it doesn't delete the old profile image from the profile_pics folder. Would appreciate any feedback on both issues please.
@scottyleitzke64985 жыл бұрын
When following this tutorial, I couldn't get my u_form or p_form to appear on the profile page, just the update button, picture, and the box outline. Any help would be appreciated
@rozhanynzn82075 жыл бұрын
i think you haven't pass variables i.e {{ u_form|crispy }} {{ p_form|crispy }} in profile.html file or in forms.py check your class Meta see its uppercase meta M should be capital letter
@rosssymonds5 жыл бұрын
@@rozhanynzn8207 I have just checked and I have written meta with a capital M.
@jamesmiddleton51145 жыл бұрын
@@rosssymonds I am a dumbass after scrolling over the code for an hour I realised I had forgotten to pass context as an argument in the return statement return render(request, 'users/profile.html', context). Hope this helps!
@inodecode76005 жыл бұрын
@@jamesmiddleton5114 omg that fixed mine, thanks brooo
@clare97624 жыл бұрын
@@jamesmiddleton5114 Did the same thing, thanks!
@g3org32104 жыл бұрын
A couple of issues i've got: 1. next to 'Currently: image path/name etc.' i get a tick box that says 'Clear' which if ticked and then submitted will through an error : 'The Profile could not be changed because the data didn't validate.' 2. if i drop a picture in the 'media/profile_pics' and the update with that one would save me another resized picture/file with a suffix type naming on the end instead of overwriting the original just with the new size and keep the naming; i.e if i were to upload the same image over and over i'd get multiple files with a different naming suffixed. Thanks for the course Corey.
@theglammcoder4 жыл бұрын
Same problem whenever i click on clear it shows an image attribute error
@theglammcoder4 жыл бұрын
Same problem whenever i click on clear it shows an image attribute error
@theglammcoder4 жыл бұрын
If you solve it thn plz let me know also.
@ranjithak43255 жыл бұрын
Hello Mr.Corey, I really like all your videos, i have a request if you can do a tutorial for reactJS and django application that would be really helpful. Best Regards, R
@dpapa21754 жыл бұрын
Is to late to ask for additional suggestions about resizing the image? I like what you have, it works, but would be cool to see your other research, too.
@tomwojcik6 жыл бұрын
19:35 imo you should pass *args **kwargs to both `save` methods. Also, I'm not sure Image closes automatically. I'd use `with open` on that `self.image.path`.
@mykoolspam3 жыл бұрын
Question for around 3:00-4:00 minute mark: Why does UserRegisterForm and the UserUpdateForm have the attribute "email", but not "Username"? My understanding is that you only need to define the attributes that do not currently exist in the User Model; however, it looks like both Email and Username are already defined in the model. So why do we need the email attribute at all?
@dhanyadave6146 Жыл бұрын
Hi Corey, thank you for sharing your knowledge with us. I had a question, can we add an image field to the UserRegisterForm and then ask the user to provide an image when they register?
@deliciafernandes99464 жыл бұрын
Start from 8:40
@egemenguney17154 жыл бұрын
i've laughed like for 3 - 4 mins for this cute dogo hahahah :)
@jakubcharkiewicz51123 күн бұрын
Does any1 have a problem with forms? I cannot see the forms under the profile info although I fallowed Mr Schafer's steps
@DrArleth5 жыл бұрын
Hi Corey - I was wondering at 13:22 we have added both the u_form.save() and the p_form.save() - however, we have also added a signal that is supposed to save a profile each time the user is saved... so my question is - is it really necessary to also call save on the Profile form here?
@cfhsdowellm5 жыл бұрын
I updated my profile picture after removing p_form.save() and found that it updated without issues.
@yashwanth_ravula15 жыл бұрын
In the previous videos, we ran migrations after making changes to models.py file. Here @22:10, how is it still working fine without running migrations?
@main_py58535 жыл бұрын
Bro, he didn't add any new model fields in this video, he override the save method from the parent class!
@22vipul6 жыл бұрын
i have an issue which i am unable to locate. i am unable to see the profile update form on the profile page. sm1 pls help.
@daksh_sagar6 жыл бұрын
Are you sure you are passing instances of UseUpdateForm and ProfileUpdateForm to the render method ?
@22vipul6 жыл бұрын
@@daksh_sagar thanks for the help daksh bhai. i was not passing the context to the render function. now it works superfine.
@avvvqvvv996 жыл бұрын
you're both fucking legends everyone else with this problem: don't forget to add the context variable in views.py
@thomasandreasparpoulas95446 жыл бұрын
Avvv Qvvv you are actually the one that pointed the spot, I was too burned to find the 'render method'... views.py and inside return render, with a coma after 'users/profile.html', add "context" (without quotes)
@avvvqvvv996 жыл бұрын
that's cool i was only able to fix my problem by reading what the above dudes said
@humanOSx6 жыл бұрын
It will be great if you can make a little tutorial show us how to delete old images while saving new in the profile section. Thanks for your awesome work man.
@abdelazizabdelioua8906 жыл бұрын
# Delete Previous Image To Avoid Duplicated Images Of Same User. previous_image = os.path.join(settings.MEDIA_ROOT, request.user.profile.image.name) os.remove(previous_image) I did it you can add this code after checking request method before saving new profile
@humanOSx6 жыл бұрын
@@abdelazizabdelioua890 Thanks.
@apoggione84 жыл бұрын
Thanks for the video Corey. It appears the UserUpdateForm doesn't provide any feedback when a user tries to update their username/email to one that's already in use. How would you go about handling that? I'm sure it's possible with with a little documentation digging. But if anybody has a quick solution, I'd love to hear it.
@codinger41824 жыл бұрын
While resizing the image, does it maintain the image or squishes to match the dimensions?