Hello, friend, welcome back.
In a previous video, we successfully complete our chain sponsored option, so now in this video, I
wanted to work with our user profile inmates.
So if you want to work with this user profile inmates, first of all, I want to do like I want to add
some of the default inmates.
So that will be I just take one of the inmates for the download, not JPC for now, go to our directories.
So that is our project as my block project and the media tool in the media folder here.
I just added one of the pictures that is a download of Tabrizi.
OK, so if you want to work with these images, then we have to do we have to add some of the things,
you know, are you all right?
So right now I just simply remove everything.
And the main part, that means our main block project.
And you are still seeing that you are lady.
First of all, you have to import our settings.
Right?
So from here, first of all, I just loaded I have already discussed about the things we do friends.
So that is the Django and that gonif like that in the config.
And from here we have the input, the settings.
So that is our settings.
Right.
And also from from Django, from the Django than the Country Cantrip and then our static files,
static files and then you else from the the static files, you or else from here we have to import,
we have to import that static.
We have to import that static.
We have to import that static files.
You are Alberton.
So there is I have already discussed about the things we do in fundamental that you are ill and pattern,
OK, that is you are Patton, so make sure you added.
So if you are working with these images, we have to add our settings and then our static files and
you from you are all we have to import.
That is static and the static files.
You are patterns.
And also here after this.
After this we have to add as you are well, you are old patterns, you are old patterns.
And from here there is a plastic little plastic world that our static files you are pattern.
That means that swan is that you are patterns here.
We have to load it.
And also another model.
You are the patterns from your old patterns, you to be as a plastic roll and then is static.
So with this static here, we have to add two of these things.
We have to add that mid-April and the media are outright so with the settings and that means the settings
and the settings area.
The result will be, as a media media underscore, you are all right.
So that will be our media role.
If you go to our settings into the settings.
I have already added most of this.
You consider the media route and the media.
You are.
So now, first of all, we have to add both of this.
So that will be in our settings and the media world and the media world.
And after that, there is a document route, document underscore route so that the default one friend,
we have to use it if you want to, working with the images.
So that is your settings.
And from here we have to have that media route.
OK, media and then media that route.
OK, so we have to add it and also into the media area, into the media folder.
I have already loaded one of the picture as a download deputy.
So as a tool here, I want to do with this user will be locked in, then this user profile image will
be visible.
So if this user had already and some of the profile images, then you should be visible right then when
this user will create one of the profile by default, one of the images will be visible and that will
be our by default image.
OK, so it will be as a by default image.
And then this user want to update new images, then he can update it.
So if you want to do that work here, I want to do it in our profile.
So that means our profile, that e-mail.
So now go to our profile.
That is a profile of Daniel Silva, the profile of this area.
I wanted to put one of the condition.
So after the profile.
So here I want to do and the food on the if condition, everything will be more clear to you.
Don't worry.
So here I take one of the if condition and with this.
Sorry.
So here I had it on the if condition and if that with the user.
So with this user.
If you go to our that is our app logging, if you go to our app logging models into the models, you
can see that is actually take our all that relation and name my name ID with that, our user profile.
And with this user profile, we get all the our details from our user class.
And I take the things with these variables with this user, we can actually access our all the feel.
You can see we access our user name, we access our email and the first name.
The last name.
So now with this user.
So that is our model.
So with this user I want to do that is another feel for our images that in the profile pic.
Right.
So I have already created one of the table and that is our table feel as a profile picture.
So now I want to do want to access our this user, our relation name, and I may meet with our user
profile.
So now with this user, with this user, I may meet our user profile.
That means this will be assigned our user all the field.
OK, and then after that here I want to do if this user as a user profile, then I don't want to add
one of the, um, images.
So here that means our default images and aless will be displayed out before me.
So I name it another one of the URLs, OK, Ale's is will be displayed another one.
And after that we have to do we have to end it there with the end if condition.
Right.
So here I want to do want to load on the image stack image tag image essentially into the image search.
This will be our dynamic image.
That means which image is this user updated.
OK, so here we shall be dynamic one of the images and else then it'll be if this user profile that
have any user OK, that means if this user have if you go here, if this user have any profile image,
then it should be displayed on particular this portion, this portion rather than should be displayed
our default image.
So now for to.
To put it so, that will be as a dynamic, so that is in our media.
OK, that is in our media and then with this user.
So with this user, I want to do I want to display our which pays to display our full name.
So that is in our model.
So with this user, our relation name, with our user profile, so with this user profile and want to
access our these people, that means that there are additional Lynnfield as a profile picture.
So now I want to do and to access it.
So that will be displayed our profile emails and also then it's also used to display our DC strategy.
So here in our media folder, I have already added all the downloaded JBC.
So it will be as a static, one of the images in the media and then our download download or JPC and
then it shall be displayed our this image that is our default image.
OK, so now let's check this out.
If you now click as Savol, if you don't click and save.
Well, first of all, to check it, everything's running well.
And now I want to do and refresh it.
Yes.
You can see so perfectly display our default image.
So right now, this user didn't update any images in our particular D.
Filled area.
That means in our they have the one feel as a profile piece.
Right.
So here I didn't upload any images for the results.
By default, our image is our default image is visible.
That means our this image is visible.
And here also fun to put on the glass as a round circle.
You can use it so better.
Here, here.
I wanted to put on the class and I name it as a rounded, rounded circle
around the circle.
So now if you click the save all and now refresh it here, you can see now it's actually around the
circle.
So now I also want to add that plus and add the plus for our dynamic picture so that it will be our
same class I hope is very clear to friends.
So now our image is visible.
So also here you want to put some of the white for this image.
You can put that white right down the resource plaza here.
After this, I was put on the wide and wide as a 120 pixel.
Now let's check this out again.
Click the save all refresh it here is now perfect.
So that is the image side I want to use.
That is a white.
So I just copied and also pasted for our dynamic image.
So now here, what exactly we have to do like here I want to do want to add on the button for change
that image.
So in this user actually created some of the account by default, our default image will be visible.
Right.
And after that they have the two portion like here I want to add on the button for the change I made.
So first of all, if this user want to change their profile image, then that is our default image will
be replaced with our new image.
Right.
That means this is new image.
And after that, if this user want to update that image again, then what exactly will replace it will
be replaced that current image.
Right.
That that might be some of the current images.
Then this current image will be replaced by the new image.
So they have the two portion I hope you can will understand about it.
So don't worry, when I actually activate it, then everything will be more clear to you.
So right now they have the default image.
I want to do fast work is I want to replace our this default image to that user new image.
OK, so how can do that work for doing this here.
I want to do want to add one of the button.
So that is our SAAC here.
OK, here I want to do undertake one of the bracket and I just take one of the Hadith and I take on
the bottom name as a jain's.
Sorry, I name it as it changed my name into the change profile profile in picture.
OK, I name it as a change profile picture and here better I put on the glass, I put the glasses a
bit in between info and then with the NSM, so they step up on the button down to create their save
all.
And now if you refresh it, you considered one of the button as a change profile so that no, first
of all, I want to do I want to create the function for change this profile.
Like if you click on the change profile, then this user can able to change their default image.
It should be replaced with our this user new image.
Right.
So for doing this, we have to do we have to work in our form.
That means right now that is you are.
We don't need.
And then the view will be needed.
Uh, profi that models and then setting, we don't need the setting.
So for doing this, first of all, we have to do work.
You know, our app logging and the form and the family are so into the models in the model that is actually
our field right now.
First of all, I want to do want to take out this user profile.
So if you want to take it, first of all, you have to do have to put it right.
That is in our form in our app.
That means from what app?
Logging.
There is a model's blocking models from here down the line to import our this glass that is our user
profile because of the user profile.
Plus, I have added our field for the profile.
So now I just simply import it.
And then also I want to create another class, I create one of the class and I just name it as a profile
piece, profile piece.
And first of all, here we have to do we have to load the form that with our Django default forms and
then I want to do it will be inserted our model form that we the Django that have done their model model
from.
So now I don't want to load it.
So it been edited our Django model from.
And then I want to do I want to add our class, that is, I want to create another middle class.
And I just that will be as a matter into the middle class area with this model.
OK, with this model, I want to do I want to add our this class.
That means our user profile and I just simply load it.
So now for the change profile picture I want to do in our view, that means in our view here, we have
to create one of the we have to create one of the function.
Right.
So this function also will be as a logging, bigger because of all this profile.
That is our profile picture.
So when this user actually logging and after that logging user can change their profile, that so it'll
will be as a logging record.
And then I name it as a Dave, one of the function name.
I name it as the ad.
OK, add our profile, our profile picture and just name it and which will be past that request.
And then I want to do I want to take one of the form.
So from will be our I have created one of the class.
So that is our profile picture.
Right.
So now I want to access it.
So here I just simply access it.
So that will be our profile picture.
So if you want to access it, first of all, we have to do we have to import it.
Right.
So we have to import it from our form.
So I have already put out and sign a form that user profile change and no want to add our new one as
a profile piece.
Perfect.
So that is our profile piece.
And after that, I want to do want to return it.
That means from here it should be done a return with the renderer and into the return in there with
the request.
I don't want to create one of the pays for this as a, you know, app logging into the app logging area.
I want to create one of the base for that Minsoo and actually user click on here.
It should be loaded onto that at that pace so that the page I want to create in our app logging on to
create one of the new page and I just name it as a pro.
OK, profile and picture that in the profile picture.
Add DOT estimates.
So this step up on the page I want to create.
I just copied.
Sorry I didn't save it so open it.
So still be as a pro profile picture.
And so I just copied and now I just simply create one of the new one as a profile picture add and here
it will be as a profile picture.
Add this HTML and also that is our form.
I want to parse that form in our dictionary.
So if you want to pass it.
So with the contest that will be our discussion into the discussion.
That will be our form and I pass it our form.
So now we can actually use that form in our base.
That is our pro picture at this Tamalpais.
That means here.
So this will be just like old logging, OK, from now logging.
I just copy everything from here and now in our broad base, I load it suits will be extended our to
email and also here I want to load onto the form and I want to load on the case before and the title
will be I or title will be as a profile picture profile picture update.
So that will be as a profile picture update.
And now and here it will be as a add your profile picture.
OK, this will be as sure as I add the.
Full picture, and that will be one of the form and the from here I pass on the form, so to load this
form on here, that will be as crispy and then we see yourself talking and that will be on the button
at the submit button and then button class and it will be as the add picture.
OK, sorry you be as the add picture and then form.
So friend here one thing.
So I want to do, I want to update the images.
So when you pass any kinds of images that are then here also we have to do we have to add one of the
NC type in particular that area.
So if you want to use that insideout, that would be the NC type and then you can see that in multiple
form data.
So make sure you add it.
Without this, you cannot upload any new images.
Just so if you want to working with the images, make sure you add that NC type as a multiplatform data.
So now if you want to access it for access it, we have to do we have to create on the wall path.
Right.
So, you know, logging and you are well here.
I want to create one of the new one.
And I just named the chains like Chains and Key Chains Profile.
Profile emails, so they step up one of the name I want to declare as a Chiang's profile image.
OK, and then into the view I have created on the function or function name as the Adepero picture.
That means that is our function and I name it as the ad per picture and also name that that picture.
So no one to load out this name that is this your name in our particular Bartonella that is in our profile.
Now go to our profile page and the profile page here.
That is our change profile picture here on the landlord.
Our this you.
So that will be as you are little.
And then that is in our app name as the app logging's.
So with this app logging on to do an index, that's our part name, our pop name as a at pro picture.
No, I loaded our ad per picture.
So now if you click on the save all I click here to save all.
First of all, I want to check that server and the server area here.
You can see snowshoeing as it Django Forms has no attribute as a model farm area.
That means e that is actually that or is visible in our forms.
That is form Dark Fae go to our farms.
So that is our farms dot FYI.
And here you can see the really spelling mistake.
It will be as a model form.
If you are OK, you should be as a model for them and also for this model and want to assign some of
the fields that miss our field data.
So after that, here I load that feels right now, first of all, I want to take all that our field
data.
So if you want to take, then you have to write down the double on the line as all.
So that will be as all.
So that is all that form that I want to load.
So that will be our form data.
And also there is a profile picture.
So right now I want to do and duplicate the save all and I want to check it again.
Yes, you can see our server is not totally running.
So here I pulled one of the spelling mistake.
It should be as a form that, OK, that is a model form.
And I just take all the Darfield.
So now let's check this out.
If you click the refresh now click as I change profile picture.
Yes.
You can see.
So here friend, I have used that all.
OK, you can see I have used that all for the resources is also getting our all that user data, that
is all that user data and then our profile picture data.
So that is actually the things I have assigning in our model into the model here, considering our user
data.
And that is our profile picture.
So that is our profile picture field and there is all that user data.
So here I want to do only our profile picture.
That file option will be visible here.
I don't want to visible that user.
So for now, in our form into the form area, I declared our all that feel for the business actually
is getting all the data.
So if you want to display specific particular on the field, that's right.
Now I want to do on display our only this profile picture feel.
Right.
So here I want to visible visibility.
So you have to do you have to add that with our bracket.
And then here we have to add that our profile picture.
So that will be our field.
I just simply added our D profile picture file will be visible.
Now let's check this out.
If you're looking to save all and now if you refresh it.
Yeah, now you can see it's not visible.
Only one feel.
And that is our profile picture.
So now we have to do we have to work for our upload that image in our that means, in our view, into
the view.
That is our method.
That means this function.
We have to work OK, so we can do that work better to continue this process.
In our next video, I will show that things with a live example.
So thanks for watching and I'll see you in the next video.