Quick heads up for 14:00. os is not imported by default in my case, as BASE_DIR uses pathlib instead of os. Add the extra line manually: import os
@abeflor88304 жыл бұрын
MEDIA_ROOT = Path(BASE_DIR, 'media') thanks man
@wabschall3 жыл бұрын
@@abeflor8830 You can also just use slashes. MEDIA_ROOT = BASE_ROOT / 'media' docs.python.org/3/library/pathlib.html#operators
@prasangsinghal78873 жыл бұрын
Django switched to Pathlib from version 3.
@Ionannes3 жыл бұрын
Thanks.
@Amanda-qu9uw3 жыл бұрын
@@abeflor8830 Thanks guys!!
@congcuongnguyen4132 жыл бұрын
0:22 - profile model, one to one relationship 3:06 - image field 3:47 - __str__ method 4:56 - migration 5:44 - install Pillow 6:36 - add profile to admin page 9:06 - interact with profile on shell 12:41 - setting media root, media url 18:22 - profile template 20:57 - add media route into project url pattern 24:38 - upload default.jpg 26:20 - django signals 32:10 - import signals into ready function of apps.py
@mishterpreshident5 жыл бұрын
I have a long-term university-paid subscription to Lynda and have spent many, many hours there learning code. It's a great service, and I love it, BUT THIS VIDEO SERIES IS BETTER than any series on Django I've found there!!!! You have filled in a number of "blanks" left by other tutorials and I feel much more confident that I actually understand the framework now.
@Digital9635 жыл бұрын
I have had the same experience and feel exactly the same about the paid Udemy courses on Django. We are blessed to have this CH.
@christianramirez89056 жыл бұрын
You are legitimately the best teacher I've seen on KZbin. With other tutorials here on KZbin I follow along but feel like I don't actually learn much. But with your explanations it's easy for me to follow along and apply the knowledge into my own projects!
@Digital9635 жыл бұрын
I feel the same, we are blessed to have this Ch.
@hafiz1238755 жыл бұрын
AYYYEEEE MY GOOD SIR
@cs_patterson5 жыл бұрын
I'm a student in Ghana(West Africa). I don't have the means to contribute to the patreon....but surely, I'm going to make so many others wanting to learn python and Django/flask hear of you. I'm so grateful for the impact you're having on me.
@coreyms5 жыл бұрын
Thanks!
@SiphoMkhwanazi5 жыл бұрын
At first I thought Django was a bit complicated.. Corey made it seem easy and my confidence has grown.
@reenadangi14985 жыл бұрын
You are the best ! I am in a coding boot camp and I feel your videos are much better than boot camp! Will pass on money as soon as I start making some !
@mikkeljrgensen38506 жыл бұрын
I've been looking for a sensible explanation for this bit for roughly 4 months now, and I just wanted to express my absolute awe. Absolutely professional, handy with the ol' typewriter, no rubbish code and moreover no rubbish small talk. You sir, are a God among ants within the django tutorials realm, hands down. An instant subscription was made, obviously. Thank you ever so much for taking the time to make these videos ^_^
@crimcrow6 жыл бұрын
I just sent 15€ from paypal for your amazing job. I did few tutorials and yours is so clear. Thanks again :)
@coreyms6 жыл бұрын
Thanks!
@bartox-tt4pg5 жыл бұрын
@@coreyms Can you give us auto subtitles pls. It help me a lot :(
@akashgkrishnan95964 жыл бұрын
This tutorial is the best tutorial i hve seen so far. its the best. paid contents dont even have the explanations. I will donate when i land my first job as a django dev. thanks a ton corey
@coreyms4 жыл бұрын
Thanks!
@anujkondhalkar97764 жыл бұрын
Yes. Me too.
@Eddyyc5 жыл бұрын
i found that putting the picture of who displayed the comment looks much nicer, so in the home.html right above the post.author if we add the line the post section looks a bit nicer, i am new at this but thanks to Corey i was able to understand some concepts.
@oussamafqihberrada51113 жыл бұрын
That's a very nice touch, thanks
@jaycel7796 жыл бұрын
Firstly, Great tutorial Corey! Simply the best! For those of you having issues where the profile isn't saving or the default image isn't showing up, please make sure to tab properly. In the apps.py file in the users directory, please make sure that 'def ready(self):...' isn't on the same column as 'class UserConfig(AppConfig). Tab appropriately. Hopefully, this helps someone. God Bless!
@ginisksam4 жыл бұрын
Am still having problem of not getting the default images showing after following your suggestion. Will move on to next Part 9. Cant wait to continue.
@SaudMukhair9 ай бұрын
@@ginisksam hey i am getting the same issue here ? can u help me with this ?
@sc1ph3r343 жыл бұрын
For those not getting a profile pic to load around the 25:30 mark, make sure you're putting the default.jpg into the project_name/media folder, and not in the project-name/media/profile_pics folder. I didn't listen to Corey closely enough, but he mentions this specifically, although it seems minorly counterintuitive.
@snerd69363 жыл бұрын
I NEEDED THIS. Thank you for pointing this out.
@Will_CS2 жыл бұрын
none of the images are loading, can't figure out why. do you got this issues too? note: the files are at the correct directories
@homosociologicus20002 жыл бұрын
@@Will_CS Had the same problem. Along with urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) try adding to the root urls.py this urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
@josephinewai87702 жыл бұрын
@@homosociologicus2000 Thank you for this, I followed this and got my profile pic loaded!
@Beaupa762 жыл бұрын
@@homosociologicus2000 thanks for taking the time. Helped me as well :)
@Andrey-ny2dv9 ай бұрын
Man, I run into some issues like Pillow, and I am like "oh, man, I need to solve it because Corey has it installed". I solve it and then next frame you are showing what to do. Really appreciate your work.
@StevenTse5 жыл бұрын
thankyou Corey, great vid great work! btw, for those struggling on default picture, create a profile for your user (without adding picture), because you need to create profile for the user in order to add default picture to the profile.
@namesare4fools5 жыл бұрын
THANK YOU !!!!.. i just gone mad searching for solution XD
@ramfattah2755 жыл бұрын
Thank you !!
@motlatsimoea4 жыл бұрын
Thank you for this! was getting frustrated
@djsmanoj00004 жыл бұрын
Sorry im going mad for the solution can you explain it briefly? Please @motlasti
@motlatsimoea4 жыл бұрын
@monoj sorry for the late reply. African timezone. My understanding is that that users you created before you created the Profile model do not get a profile, which also means they don't get an image field. Only those users you create after creating the Post model will have the image field apply to them. Furthermore, take care to store that default picture in the right place. I made a mistake there as well. I hope this helps.
@ABASSANIMERIKUKU2 ай бұрын
I think up to this far, my love for Django is as strong as the tutor....such amazing work. God bless you.
@dagmawigutu2434 жыл бұрын
Hands down the best teacher I've ever seen! , i wish we had more like you. Thank you for generously sharing you're knowledge 👏👏
@JavedAli-fu4kk4 жыл бұрын
you are the best teacher in the world. I have seen many videos and I have learned many things from you. 3:08 we have to specified the related_name='profile'. so the reverse accessor will be called profile not userprofile.
@remixowlz4 жыл бұрын
You're really amazing! Even after 1 year and I came back again to relearn and I am able to absorb everything smoothly from you! Thank you Corey!
@entertechinc5 жыл бұрын
Excellent Teacher! You make me to love the Django framework more and more! Keep the awesome work Corey. Simple I have to say thank you so much!!!!!!!!!!
@carlfranz68052 жыл бұрын
re: signals (31:10)... Corey: "I hope that makes sense..." Me: "Not even a little." 🤣
@paridhigupta27472 жыл бұрын
I couldn't have learnt Django without these series. You're a magician Corey.
@nicachipal16 жыл бұрын
Man, I love your videos. You are one a few BEST Teachers on this planet.
@moe3551 Жыл бұрын
Big ups for Corey! He's the best. Thanks alot for this tutorial, even after years of django experience, I'm still coming back to this tutorial!
@lardosian5 жыл бұрын
For those having problems with creating a user profile Corey has pinned the solution in the next video.
@o1-preview5 жыл бұрын
Thanks for the head up²
@منبرالعلوم4 жыл бұрын
There is nothing in the next vedeo
@alimamdouh4933 жыл бұрын
@@منبرالعلوم You need to add your app under installed apps as ''appname.apps.AppnameConfig' if your profile isn't being autocreated!
@piacademy19913 жыл бұрын
@@alimamdouh493 thanks a lot.
@landolabrum3 жыл бұрын
DEFINATELY THE BEST DJANGO TUT I've seen! thanks!
@deepakpatidar84624 жыл бұрын
For anyone using Path from pathlib library, and getting an error saying 'os' not defined, please replace the following line from the video: Replace: MEDIA_ROOT = os.path.join(BASE_DIR, 'media') With: MEDIA_ROOT = BASE_DIR.joinpath('media') Also, if it still throws error, please check that you have the following line in your settings.py: BASE_DIR = Path(__file__).resolve().parent.parent If its not there, please add it right after the Path import (where you should find it if it is there) Great tutorials Corey :)
@fabrzy37844 жыл бұрын
dont you just have to do "import os" in the settings file ?
@deepakpatidar84624 жыл бұрын
@@fabrzy3784 no.. since we are not using the os library, we are using the Path library which should be imported beforehand ^^
@fabrzy37844 жыл бұрын
@@deepakpatidar8462 but if the error is saying "os not defined" i fixed it with just importing os
@fabrzy37844 жыл бұрын
@@deepakpatidar8462 also you are using the os library
@deepakpatidar84624 жыл бұрын
@@fabrzy3784 yes, you can import os library and use the exact same code that is shown in the video.. I'm not using os library, and my comment focuses primarily on using Path library instead of os library.. since when I created a django project recently, os library was not imported by default in my settings.py file..
@kylefleming95563 жыл бұрын
Love the comments, I reference this tutorial at least once a year as a refresher... Thanks for your kind work!
@ralphcaritativo20335 жыл бұрын
DONE TUTORIAL #8! Thank you SENPAI! :) BTW im from Philippines 😁
@johnlemontv75904 жыл бұрын
I`m fresh Grad and sure this one of the best series so far to start. Thanks a lot bro
@SIDDHANTKUMARSingh10on105 жыл бұрын
I loved going through your tutorials.
@Digital9635 жыл бұрын
Cory, I truly cannot thank you enough for your content! Please also consider doing some Q&A as a live stream, that would be great! Thanks again!!!
@Kornchipzzz4 жыл бұрын
If you get the UserDoesNotExist error, PLEASE double check your function name. I forgot to rename it and I had 2 create_profile functions. 20 mins of debugging later I found it :)
@firstofherkind41363 жыл бұрын
Having this issue. Still haven’t been able to fix the problem.
@shubhamsirothiya25513 жыл бұрын
@@firstofherkind4136 I am also getting this error ModuleNotFoundError: No module named 'users.signals' can u help me?
@skarverse4 жыл бұрын
tnx to your videos ,those were my first step in django , i am glad that i found your playlist first.....i came now to refer about image field again😁 31:26 i found that we can use PROFILE_OBJECT,CREATED=profile.objects.get_or_create(user=request.user) in views.py we can pass it as instance to form or work it out based on requirement i thought it might help someone i found this after searching for three days
@brownbread29164 жыл бұрын
Should incase you have errors implementing the signals, you can do this to your users models.py file def save(self, *args, **kwargs): super(Profile, self).save(*args, **kwargs)
@gauravabhishek39304 жыл бұрын
thanks brother. it worked
@brownbread29164 жыл бұрын
@@gauravabhishek3930 glad it did mate
@arunaiarun14094 жыл бұрын
@@brownbread2916 In user model.py we have only Profile model.. are you saying to override profile model save() method
@paulrodriguez50584 жыл бұрын
absolute life savor thanks g
@liorbm14 жыл бұрын
Thanks!!
@akashdipbaral2545 ай бұрын
24:20 If anyone having trouble with the profile image covering a large part of the screen or the entire screen, you can edit the template 'profile.html' to specify the height and width of the profile image like the following line:
@akinsolasalem3715Ай бұрын
profile image not loading at all. i will appreciate if you can help me with that
@ErzaKanekiАй бұрын
Tyvm for this tip!!! Helped me understand how to modify the image! Props!!
@william.darrigo4 жыл бұрын
Just want to give a shoutout to someone very important in my life who inspired me to pursue programming....... TESTUSER you the man
@zacksims36233 жыл бұрын
Definitely the most dense tut in this series. Might need to watch this one twice, but it was well layed out. Thanks!
@fantomgamer96842 жыл бұрын
If you are having problems with the default image. Ensure you rename whatever picture you're using to default and place that image in the media folder not the profile pics sub folder in the media folder
@investmentapps78265 жыл бұрын
On my next paycheck, I will contribute to you, I am really enjoying your tutorials. Just for information to other viewers, if you have left the server running whilst saving the models.py file it will tell you (HINT) that you need get Pillow. It also shows other useful typo errors. I also understood the importance of reading the documentation and testing out things.
@coreyms5 жыл бұрын
Thanks!
@RahulKumar-tg5zb4 жыл бұрын
For those that the profile wasn't created automatically, you must put it [default_app_config = 'users.apps.UsersConfig'] in your users/__init__.py and also check that default.jpg should not inside media directory . But both media and defalt jpg should be in same place.
@Elmonolitvideos4 жыл бұрын
Thanks!!!
@gee_rex3 жыл бұрын
thanks Rahul, i was actually stuck there
@gee_rex3 жыл бұрын
but am now stuck here - ImportError: cannot import name 'Profile' from 'post2.models' i named my app 'post2' this happened while trying to create ProfileUpdateForm
@Zenithh5 жыл бұрын
If a profile doesn't get created when you sign up a new user, add: default_app_config = 'users.apps.UsersConfig' to the __init__.py file in the users app. This solved my issue, even when the code was correct and I followed the steps in this video properly.
@sitaramchikkala5 жыл бұрын
@ProducedByZenith This didn't solve my issue, what else can be done ??
@Zenithh5 жыл бұрын
@@sitaramchikkala Not sure mate, just search online with your issue and see what the internet says on how to fix it.
@jnyfah5 жыл бұрын
@sitaram chikkala have you gotten a solution ?
@umdmrlbro4 жыл бұрын
at 32:15, why do we do instance.profile.save() ? Where is 'profile' with lowercase 'p' defined?
@huboy20044 жыл бұрын
Did you find out why ??
@erickssonnastor53594 жыл бұрын
i feel like it has something to do with "users/views.py" where @login_required is needed for save_profile func to work. Not really sure if this is right tho but let me know if you find out the exact reason
@umdmrlbro4 жыл бұрын
This seems to be a Django convention to do with OnetoOne model relationships. In this case, we have a 'Profile' class in our models.py with a OnetoOne relationship to user defined as: user = OnetoOne(User, ...). I don't know the correct terminology here but this is my understanding of it: when we have a view (or in this case a signals.py) where we have direct access to a 'Profile' instance, we can get it's user by doing instance.user.whatever_attribute However, when we try to do this in the opposite direction (i.e. we have access to a 'User' instance and we want the users 'Profile') we do instance.profile.whatever_attribute with the lowercase 'p' in question. When you define a OnetoOne (or any model relationship like FK) relationship, it is obviously only defined within one of the models. In this case, we explicitly define the relationship within the 'Profile' model. I think when we do this, Django does some magic under the hood where it creates the relationship in the opposite direction, i.e. it does the equivalent of profile = OnetoOne (Profile, ...) within the 'User' model. When it does this, it seems to simply take the lowercase of the name of the related model, in this case 'Profile'. Not a satisfactory answer, I know, but Django seems to do a lot of things like this. Another example is when you create a new app in your project. The app config name that you include in your project settings.py is automatically generated by Django in the apps.py, so for an app named 'profile', Django will generate a 'ProfileConfig' class in the app's apps.py file. EDIT: The answer is here docs.djangoproject.com/en/3.0/topics/db/queries/#additional-methods-to-handle-related-objects "If a model has a ForeignKey, instances of the foreign-key model will have access to a Manager that returns all instances of the first model. By default, this Manager is named FOO_set, where FOO is the source model name, lowercased. This Manager returns QuerySets, which can be filtered and manipulated as described in the “Retrieving objects” section above."
@umdmrlbro4 жыл бұрын
@@huboy2004 I have found the answer here: docs.djangoproject.com/en/3.0/topics/db/queries/#additional-methods-to-handle-related-objects "If a model has a ForeignKey, instances of the foreign-key model will have access to a Manager that returns all instances of the first model. By default, this Manager is named FOO_set, where FOO is the source model name, lowercased. This Manager returns QuerySets, which can be filtered and manipulated as described in the “Retrieving objects” section above."
@umdmrlbro4 жыл бұрын
@@erickssonnastor5359 I have found the answer here: docs.djangoproject.com/en/3.0/topics/db/queries/#additional-methods-to-handle-related-objects "If a model has a ForeignKey, instances of the foreign-key model will have access to a Manager that returns all instances of the first model. By default, this Manager is named FOO_set, where FOO is the source model name, lowercased. This Manager returns QuerySets, which can be filtered and manipulated as described in the “Retrieving objects” section above."
@laurafernandez47442 жыл бұрын
I've been watching several videos until I came across this one, and it really helped me a lot! thanks!!
@user-yj7rc2qs8d4 жыл бұрын
If you are having this error "Instance of 'OneToOneField' has no 'username' member" in users/models at 'return f'{self.user.username} Profile," here is the solution: 1. pip install pylint-django 2. If you are using vscode, go your .vscode/settings.json and add this snipet with the "python.pythonPath" existing there, separate them with comma: "python.linting.pylintArgs": [ "--load-plugins", "pylint_django" ] -> Or, if you have a .pylintrc file, you can add this line to load the plugin: [MASTER] load-plugins=pylint_django Then you are good to go
@kshitijchourey4414 жыл бұрын
Hey, First of all thanks for addressing this issue. I'm working with vscode and having trouble with this, could you please elaborate on this a little more? I found the python path in settings but the field simply says python, That's it. Should I copy this whole snippet there?
@user-yj7rc2qs8d4 жыл бұрын
@@kshitijchourey441 Got to this link, I explain better there. If it works for u, support me there, by leaving a comment. And if you are still having a problem with it, let me know. stackoverflow.com/questions/55204906/instance-of-onetoonefield-has-no-username-member/62771766#62771766
@sarthakbhutani74134 жыл бұрын
is your profile page responsive for mobile screen??
@sarthakbhutani74134 жыл бұрын
@@user-yj7rc2qs8d is your profile page responsive for mobile screen??
@user-yj7rc2qs8d4 жыл бұрын
@@sarthakbhutani7413 To make your app responsive, you can use Bootstrap class: instead of .
@paulohsgoes19594 жыл бұрын
Man, you've been made the best Django tutorials ever. Congrats
@davicarvalho94194 жыл бұрын
I had a problem that the signal wasn't working after all of that (The profile wasn't being created). What solved to me was: 1 - Adding *post_save.connect(save_profile, sender=User)* at the end of *signals.py* 2 - Adding *default_app_config = 'users.apps.UsersConfig'* into __init__.py , that is on root directory of users's aplication
@haliax80135 жыл бұрын
First of all, thank you so much for your open-source approach and also for making information accessible and free for all. To me, these virtues are very important and admirable. On the other hand, like Einstein said: "If you can't explain it simply, you don't understand it well enough." And as also like Da Vinci said: "Simplicity is the ultimate sophistication." So because of that, i firmly believe that the ultimate success in both education and teaching is to simply teach things like a 5 years old can understand. And i believe that this ability is a very rare and exceptional ability that only a few have. Based on the videos of you I watched, I can confidently claim that I have no doubt that you are especially blessed with this ability. Congrats! If we get to the main point, my current progress is halted because of missing of subtitles in your video. As i have hard of hearing and not being a native-speaker, i rely heavily on subtitles, i just can't understand without them. So can you please add auto-generated subtitles by KZbin to this video? Thanks in advance!
@jasoncalleja1265 жыл бұрын
8:07 I tried to add profile, but I got an Operational error: no such column: users_profile.user_id. Please help.
It may be too late: But I just renamed the db.sqlite3 file, deleted the 0001 file in users app, then --> makemigrations --> migrate. You have to also createsuperuser again
@ahmedmani10514 жыл бұрын
thanks corey your making the world a better and smarter place with every tutorial
@ashishverma-mj1kl5 жыл бұрын
@32:07 why save_profile is required? doesn't line no 10 serves the purpose?
@williamxtc80545 жыл бұрын
I also a little bit confused about that part. (That part seems to me should be put into the `else` part of the first function??)
@williamxtc80545 жыл бұрын
Also, this post does not explain this part either :-)
if u won't save it, then it will just create the profile for once and next time when you will try to login again it won't exist anymore, that's why we need to save it at the back end. If there is still some confusion, then we should try out the code without defining save_profile function and see.
@NaachoElegante5 жыл бұрын
@@williamxtc8054 Regarding the ELSE suggestion, that won't make any sense because that would mean either create the profile or save it, do you think this is what we want when we login to any site :)
5 жыл бұрын
First, thank you for all your videos ! Now i have an observation: when you delete a profile or a user you don't delete the picture attached to it. So I made a signal for this: @receiver(post_delete, sender=Profile) def delete_profile(sender, instance, **kwargs): if instance.image != Profile.image.field.default: os.remove(instance.image.path) it works, but if you see something i should change, I will really appriciate your expertise :)
@stanislavzoldak21985 жыл бұрын
Your tutorials are damn amazing, I learned so much in such a short time. I have only one question - to avoid confusion wouldn't it be better to create a new User model that would inherit built-in User model? (if that is even compatible with built in auth system)
@gee_rex3 жыл бұрын
Corey thanks bro, ur definitely one of the best teachers on planet earth
@bforbelive4 жыл бұрын
in django new version we don't have OS package in settings.py so we need to add IMPORT OS at beginning of the settings.py file.. in corey's style SAVE THAT!!!!!!!
@hunterallen45213 жыл бұрын
Thank baby jesus I found your comment!
@JJChameleon3 жыл бұрын
Thanks! This should be pinned!
@MrDe02 жыл бұрын
you dont really have to import the OS package, just use the joinpath like this => BASE_DIR.joinpath('media') 🙂
@johnfluke68423 жыл бұрын
Sorry for the previous question. I discovered that my default image was actually named default.jpg.jpg which did not show up til I went to the command line. Once i renamed it, everything worked fine. Thanks again for these wonderful videos.
@karan55394 жыл бұрын
You do not need save_profile function in the signals.py as the function Profile.objects.create will automatically save the profile. Or am I missing something? Also, like every video of this guy if you have no other way to support.
@piecucci Жыл бұрын
Thank you, it helped to fix my error!
@patrickkelly30534 жыл бұрын
Fantastic. Ran into a little issue. Maybe you mentioned it an earlier video but to get this section to work you need to add default_app_config = 'users.apps.UsersConfig' to the users/__init__.py
@AnnoyingErrors415 жыл бұрын
You need to add your app under installed apps as ''appname.apps.AppnameConfig' if your profile isn't being autocreated!
@afekhaijoseph56784 жыл бұрын
Thanks alot for this
@hiit-n-lift4 жыл бұрын
Thanks a bunch for this. Was having challenges with this
@danianiazi82294 жыл бұрын
ModuleNotFoundError
@shaffics26714 жыл бұрын
I am coming back to learning Django for what is now the 3rd time, and I finally get it haha!! I actually started using your video's to learn Python back in 2018... and now I teach Software Development myself (not Django clearly haha!). Thank you for your content, it has gotten me over many a hurdle in the early days and this series has given me something cool to focus on during the xmas break! You really are an incredible teacher!
@yuriyarin40273 жыл бұрын
At 16:50, I got "NameError: name 'os' is not defined" solved it by adding the line "import os" at the top of the page
@krishnmani36303 жыл бұрын
thanks it works for me :)
@arjunnair47483 жыл бұрын
THANK YOU
@akshgpt74 жыл бұрын
The way you explained the signals part was just phenomenal! It was so clear and concise. Thank you so much for this series!
@sarthakbhutani74134 жыл бұрын
is your profile page responsive for mobile screen??
@sarthakbhutani74134 жыл бұрын
can you help please
@akirankumar19986 жыл бұрын
THANK YOU SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO MUCH MAN!
@ulandokturbekuulu77524 жыл бұрын
I love your django series and I am going to watch your other videos as well as soon as i finish. My personal advice for you is to promote your youtube channel on instagram if you want of course. Because people gotta see this masterpiece. Thanks a lot man!
@jianwang82734 жыл бұрын
In User class, we never define a class variable called "profile". How can we access user.profile? And why not the capital case user.Profile?
@mountaindiaryfilms6204 жыл бұрын
In models.py we defined one to one relationship of "user]" with User Class. and post that we defined function based views "profile " in views.py . which we are returning request to profile.html. and "user" is a keyword from django for logged in user. So we can access" profile" through user.profile.
@tommyeagen37634 жыл бұрын
it is related to user model by one to one relationship so we each user have 1 profile so django model offers us that power
@grzesupel5 жыл бұрын
One of the best tutorial and profile to learning python, very clearly explanation, thanks!
@mazeenmuhammed5 жыл бұрын
Even though I place the default picture in media folder , djaamgo isn't able to pic that up ..
@jjmovies8675 жыл бұрын
name that image as default.jpg
@Dubyarex5 жыл бұрын
Click the link on github to actually see the image then right click and save as. Should fix it
@idugi5 жыл бұрын
make sure it's not inside the profile pictures subfolder, just put it in the root folder
@Sirreal455 жыл бұрын
@@jjmovies867 or...change the name in models.py image = models.ImageField(default='default_user.jpg', upload_to='profile_pics') default=anythingyouwant.png, ...
@jjmovies8675 жыл бұрын
@@Sirreal45 that's a good and better option to do as well
@monishpv83 жыл бұрын
If anyone feels confused at 30:00 , you can use this: @receiver(post_save, sender=User) def create_profile(sender,instance,created,**kwargs): if created: created_profile=profile(user=instance) created_profile.save()
@nehat7866 жыл бұрын
Dont know why i am getting this error in dev server Not Found: /media/profile_pics/Abdul_Rasid.jpeg [07/Sep/2018 17:54:17] "GET /media/profile_pics/Abdul_Rasid.jpeg HTTP/1.1" 404 3006 and image is also not showing in profile page
@niteshrawat5766 жыл бұрын
Same problem , help Corey! :P Not Found: /media/profile_pics/my_pic.jpg [16/Sep/2018 16:01:00] "GET /media/profile_pics/my_pic.jpg HTTP/1.1" 404 2759
@niteshrawat5766 жыл бұрын
Hi Nehat, Try to check the static url_pattern you have added, make sure it is using MEDIA_URL and MEDIA_ROOT instead of STATIC. Thanks
@LieviSilva6 жыл бұрын
Hey, i had the same error. The problem is that i put the settings.DEBUG on the wrong url file. This setting is on the project url file, not on the application url
@bektursunsamatuulu97726 жыл бұрын
@@LieviSilva Rename your image as "default.jpg"
@sugiyamakei35536 жыл бұрын
@@niteshrawat576 This solved my problem. Thanks!
@joanbo23464 жыл бұрын
The signals setup works perfect, even with Django's version 3.0.7. Really thanks Master Teacher
@sarthakbhutani74134 жыл бұрын
is your profile page responsive for mobile screen??
@sarthakbhutani74134 жыл бұрын
can you help me please??
@Rajshah9085 жыл бұрын
Thank You for helping me, I have one problem when I make new register NewUser3 and after that, I just login in NewUser3 goto profile page I can not view profile default image, I just try your GitHub code, but the same problem is there can you help me
@Yunghamz5 жыл бұрын
I have this problem too, did you find a solution?
@ishanpadalkar90725 жыл бұрын
Open the admin page and check if a profile is created for that user or not. If a profile doesn't exist, then the default image will not load!
@gunjanmistry914 жыл бұрын
thanks man
@ishanpadalkar90724 жыл бұрын
@Evgenii Kosharnyi True Story No worries ✌🏼
@Vuces4 жыл бұрын
@@ishanpadalkar9072 oh my god i spent an hour or so lol thank you!
@ab58484 жыл бұрын
You're just fantabulous 🙏🙏. Words fall small to describe your greatness sir🙏
@bimosyahsiraj2194 жыл бұрын
I got problem at this tutorial. Django said "django.db.utils.OperationalError: no such column: users_profile.user_id". I already checked my code and compared with your code at github and then I found no mistakes. Can you help me to fix it? Your answer will be useful sir. Thankyou
@bimosyahsiraj2194 жыл бұрын
@Indu Ji okay,thank your for the advice. Have a good day!
@sarthakbhutani74134 жыл бұрын
Indu Ji hey can you help me please??
@banjialo2 жыл бұрын
Great work mate! Enjoyed every bit of the tutorials
@roderickdanzing14144 жыл бұрын
my image wont load..is there any specific sizes or resolution of image?? tia!
@kvicar74194 жыл бұрын
I have the same problem
@kvicar74194 жыл бұрын
I found the solution. Change settings.ROOT_URL to settings.MEDIA_URL in urls.py file. It helped me, It was just a little silly mistake. Good luck
@konikarawat96534 жыл бұрын
I have settings.MEDIA_URL only, but still my image is not loading.
@pradeepnaik10334 жыл бұрын
Logout from your admin panel and then login with users credentials with frontend login page
@abutalib92934 жыл бұрын
Hey did anyone resolved that error im facing the same problem now
@slickwillie33764 жыл бұрын
So far so good. Great video! Continuing onward...
@Skaxarrat6 жыл бұрын
Why do we create a Profile model instead of extending the actual User? There is any benefit on doing it this way?
@dodokwak6 жыл бұрын
As far as I understand we use built-in User Model to make a table in the db for users and separately table for objects of Profile. They are connected with OneToOne relationsips. At the end of the video we synchronize creation of a new user and his(her) profile. Benefit - more flexibility as procedure of creation (singing up) is separated from the creation of the profile.
@davidbrown28066 жыл бұрын
With the Profile you are extending the User model. Otherwise you have to totally change the User model as a Custom Model.
@renitalobo9276 жыл бұрын
Extending the existing User model¶ There are two ways to extend the default User model without substituting your own model. If the changes you need are purely behavioural and don’t require any change to what is stored in the database, you can create a proxy model based on User. This allows for any of the features offered by proxy models including default ordering, custom managers, or custom model methods. If you wish to store information related to User, you can use a OneToOneField to a model containing the fields for additional information. This one-to-one model is often called a profile model, as it might store non-auth related information about a site user. Ref: docs.djangoproject.com/en/2.1/topics/auth/customizing/
@HaileeMiu5 жыл бұрын
Hey Corey. Since you are using a mac, you can go to system preferences>accessibility>zoom and select "use scroll gesture" and it will allow you to zoom on any part of your screen" (aka the file structure in vs code)
@coreyms5 жыл бұрын
Thanks! I might try that
@raphaelsantanaguitar6 жыл бұрын
Thank you very much for the class and the series. I have only one complaint: i think the videos are getting less and less conceptual. I see what you're doing, i can be convinced of why you're doing it but the knowledge about how the things work on the background don't scratch the surface. I'll do my homework and read more about those decorators you used, but i hope my input is well received.
@magikarpusedsplash88815 жыл бұрын
He has already made a half hour tutorial on decorators (plus two others), so he does go over it, and at the beginning of the first video he states that he won't be going over basic stuff in detail (he isn't explaining if statements or how function definitions work), because he already has videos on that content and this series is about Django, specifically. tl;dr, if he covered every underlying topic (that he already has videos about) along the way then the series would be at least three times longer.
@kiranraj-dw5gq5 жыл бұрын
Amazing Tutorials.Thanks from India .You Rock!!
@AnilGupta-iv1rz5 жыл бұрын
When i am creating the user and trying to logged in i am getting RelatedObjectDoesNotExist at /login/ can anyone explain why?
@saiday5 жыл бұрын
I don't know why, but on Django 2.2 only the last receiver receive the signal, you need to modify the codes to be like this: gist.github.com/saiday/f9e306b0ba5d73d7601ab8e4f3cc65ed
@akashgkrishnan95964 жыл бұрын
you are facing that issue cause the user you ave used for login does not have profile object present u can create a new user or update the user and create a profile object for the same user. guess you might have found this by the time i have commented. but anyways
@nz8814 жыл бұрын
@@saiday Thanks :)
@bojansimikic63503 жыл бұрын
@@saiday thanks!!! This worked for me!!!
@sapnajain91663 жыл бұрын
It was an amazing tutorial. Just want to suggest rather than righting the whole pile of code for just setting the default pic, you could have simply checked using this {% if user.profilepic.image %}
@al3ezi3 жыл бұрын
yes please where to add this ? my default pic not showing !!
@sapnajain91663 жыл бұрын
@@al3ezi Hi, Actually my code is a little different but can do this code above where you are showing your user actual Pic.Like- {% if not user.profilepic.image %}
@sapnajain91663 жыл бұрын
And if you want to go by his method just add this line in your 'init.py' file of your app name. In this tutorial the app name was 'blog', so add this line in the init.py file of the blog app- default_app_config = 'blog.apps.blogConfig' .I think by mistake he forgot to tell
@avalancherr47924 жыл бұрын
For those whom profile picture didn't load, name your default jpg image just default instead of default.jpg. Otherwise, the image name becomes default.jpg.jpg. Also make sure you are pasting the image in media folder and not profile_pic folder
@sarthakbhutani74134 жыл бұрын
can you help me please
@soumyazyx5 жыл бұрын
Thank you Corey for your time and effort. Keep spreading the knowledge.
@goshmain9826 жыл бұрын
this part was kinda confusing for me :/ especially signals part. I find it difficult to use django docs. I hope I will get through this
@coreyms6 жыл бұрын
Yes, the signals are a difficult concept to grasp. I am always needing to look at the documentation any time I do signals work as well, so you’re not alone
@direshkumarpradhan43764 жыл бұрын
@@coreyms I wanted to ask that when save_profile method was created in that we write instance.profile.save() but what is 'profile' in this because the class inside the models.py was Profile and not profile so how does it work? Is there any inbuilt variable profile just like user?
@anonymousone64543 жыл бұрын
@@direshkumarpradhan4376 did u find the solution...Me also having same issue
@sanneck4 жыл бұрын
perfect content at the perfect speed with the perfect way to teach
@dotco226 жыл бұрын
Why there are no subtitles?
@shantanugupta17124 жыл бұрын
press c on ur system while watching video
@alizolfaghari395111 ай бұрын
32:25 Why does this second signal is needed (lines 13, 14, 15)? I think it will save nothing and its redundant. am I right?
@alizolfaghari395111 ай бұрын
I removed lines 13, 14, 15 and it worked well. What is the reason of using those lines?
@Crucizer5 жыл бұрын
The New THENEWBOSTON(bucky roberts)
@jasmintumulakestudillo57645 жыл бұрын
Thank you very much for this video tutorial. It is straightforward and absolutely very professional.
@feysalibrahim95565 жыл бұрын
I think those who disliked this video were Jamaicans because they read as dis i like
@jungiealbarico27242 жыл бұрын
Warmest thanks for these quality videos Corey! 🙏
@panagiotisgoulas85394 жыл бұрын
31:24 Since you instantiated a profile instance by Profile.objects.create(user=instance) and not by doing Profile(user=instance), the save_profile is not required.
@ahmad-ali146 жыл бұрын
this is the best toturial i ve ever seen
@moebazzi84126 жыл бұрын
AMAZING AND CLEAR TUTORIALS WELL DONE COREY!!!
@sasanghaffari94244 жыл бұрын
thank you very much for the great content! you make everything look cristal clear for me as someone who is trying to learn as a beginner!
@godsplace66026 ай бұрын
I am not able to login to my django administration page after the signal functionality, did anyone encounter it ?
@Yash421892 жыл бұрын
Lol still the best after so many years and so many flashy videos from other channels.
@vegadevelopers9 ай бұрын
Amazing content and tutorial very detailed explanations! Thumbs Up.