In this lesson we're going to keep working on duty education system for our project creating all the
templates that are needed to authenticate users of your browser and tweaking all the settings that are
in fact important to set up an authentication system with Django Django this framework.
And considering that as you can see I'm currently inside these settings that profile we can start adding
all the settings from here.
Let's define the rest framework dictionary.
And yet I cannot comment Django rest framework and inside of this dictionary you can define a very important
key default authentication classes that as we've seen in the previous sections of the course allows
us to define how we want our users to interact with our platform.
We know that we want to be able to authenticate themself using both token authentication and session
authentication.
Therefore we can define default authentication classes and yet we can assign a tuple like so with rest
framework that authentication dot token authentication.
And at the same time also let's trademark dot authentication dot session authentication.
Now we can define our location for our templates.
So I'm just going to copy this line of code I can paste it here in directories and templates and yeah
we can tell Django that it has to look for the templates templates folder let's create the folder.
So
new folder templates and inside of this folder we now need to create two more folders one called Django
registration where we're going to define all the templates required by the opening package and then
we can create another folder just called registration where by default we stored all the logging related
templates used by Django considering that we want all the authentication related templates to share
a common layout.
We can create yet in the folder itself of a yellow dot HDMI file.
We can add all the basic HDMI all boilerplate code.
We can add question time as a title for the page and yet we can also define a diva with class of boxer.
And considering that we want this to be a parent template we can add block content.
And of course and block let let's also have the link to a CDM providing bootstrap and I remember you
did you can find this link at the address get bootstrap dot com.
We can start to create all the other templates that we need.
First of all logging and Dot is the email and we are extending so extends of layout not finish the email.
We also need to pass blog content and block content.
So as Dan Harris side we can define for example in H1 tag logging the Dan form and we only need the
method POST AND WELL IN FACT WE CAN ALSO encapsulate the for inside of a different like so.
And here to leave we can also add a class I mean like looking for container and considering that we
are using the logging views provided by Django we can get all the fields for the form easily like so
as always.
Anyways it always we need to pass the C S at f token and you also need to define a bottom of type submitted.
And considering that we're using Bootstrap we can add a glass bottle bottles small button primary or
even by the bottom outline primary and we're looking as you probably remember we're also using a package
called Django goodies before items that allows us to create good looking forums easily based on the
style that we've defined yet in the case B template back option.
And so to use them we can just yet important first of all the crispy forums tax load Krispie forms.
Thanks.
And here we can just use that crispy tag let's define a bit of style for our log in form container Classic
we will then add all the more advanced styling later on.
So for now can do something like looking for a container India we can define it with of that says with
margin outlook we can in fact also move the title tag above.
Like so and considering that we are using Bootstrap we can also add the text center.
So let's not create the other form that we need inside the Django registration folder registration form
dot h the email and we can just copy all the code used in logging that HDMI up but of course we can
personalize it so maybe we can use an H3 with create your question time account and yeah create account.
Then also we can change the CSX class name to registration form container.
So let's move these two awfully out so we can just copy the same CSA as code.
But yeah maybe we can define 400 pixels instead.
We can try all these new code we've defined so let's run the development server
and let's now move to Chrome so we can test the new you URL but first of all let's check the registration
path so it's less account is less registered and you see we get our form which is also nicely styled
by Django Gris before us.
Let's register in your account username maybe random random email does come and set password create
account and as you can see we are automatically redirected to the home page even though we haven't specified
any view for this path yet.
And to check if we have been authenticated or not we can go to less admin and as you can see we are
authenticated as random let's not go to slash accounts slash log in and let's log in as admin and now
going back to flesh and mean we can see that everything works fine here as well as we can see everything
related to authentication of your browser works perfectly as expected and to be fair I believe that
talking authentication is working fine just as well.
We're going to check it any way later on as soon as the backend structure is completed.