WEBVTT
Kind: captions
Language: en

00:00:00.030 --> 00:00:05.190
Next we're going to test the Django
admin now that we've enabled it for our

00:00:05.190 --> 00:00:08.790
project we can test the Django admin by
starting the development server and

00:00:08.790 --> 00:00:15.299
heading over to our local host forward
slash admin let's open up the terminal

00:00:15.299 --> 00:00:19.619
or the git bash window and make sure
that you are connected to our server and

00:00:19.619 --> 00:00:23.860
you are on the correct virtual
environment

00:00:23.860 --> 00:00:25.140
then we're going to start our

00:00:25.140 --> 00:00:30.900
management server or our development
server by typing python manage dot py

00:00:30.900 --> 00:00:38.240
run server 0.0.0.0 : 8000

00:00:38.240 --> 00:00:40.620
hit enter and this will start the development

00:00:40.620 --> 00:00:47.000
server and then we can open up Chrome or
whatever our favorite browser is and

00:00:47.000 --> 00:00:57.000
type in 127.0.0.1 : 8000 hit enter this
will take you to the Django home page

00:00:57.000 --> 00:01:04.189
and by default the Django admin is
enabled on the forward slash admin URL

00:01:04.189 --> 00:01:09.869
so if you remember in a previous video
we created a super user for our account

00:01:09.869 --> 00:01:14.820
so we're going to enter those super user
credentials here if you type...or I'm going to

00:01:14.820 --> 00:01:19.979
type mark@londonappdev.com you
should type whatever credentials you

00:01:19.979 --> 00:01:24.390
created when we ran the create super
user command I'm going to put the password

00:01:24.390 --> 00:01:31.590
is password 1 2 3 and then hit login so
this is the Django admin and as you can

00:01:31.590 --> 00:01:36.210
see you have three sections here each
one of these sections represents a

00:01:36.210 --> 00:01:41.759
different app in our project the auth
token app is an app that is

00:01:41.759 --> 00:01:46.649
automatically added or is an app
that we added as part of the Django rest

00:01:46.649 --> 00:01:52.290
framework when we enabled our tokens and
the authentication and authorization is

00:01:52.290 --> 00:01:57.290
part of Django and these come out the
box with Django and allow us to use the

00:01:57.290 --> 00:02:04.530
authentication system the app that we
created is the profiles API and the

00:02:04.530 --> 00:02:08.220
model that we registered is called
user profile

00:02:08.220 --> 00:02:09.840
Django figures out the name

00:02:09.840 --> 00:02:15.690
of the model by basically looking at
how you defined it in the class so you

00:02:15.690 --> 00:02:20.190
can see that we've defined it as user
profile so what it does is it separates

00:02:20.190 --> 00:02:24.269
the camel casing which is the
capital letters

00:02:24.269 --> 00:02:29.129
that breaks up the words in the class
name and then it just makes this one

00:02:29.129 --> 00:02:33.709
lowercase and that's how it
automatically generates the name and

00:02:33.709 --> 00:02:40.379
because the best practice is that you
make the class representation of the

00:02:40.379 --> 00:02:45.569
model a singular so you notice how this
is use a profile and not user profiles

00:02:45.569 --> 00:02:50.459
plural the Django admin will
automatically add the s because it knows

00:02:50.459 --> 00:02:55.530
that in your user profile model you're
going to have more than one item if you

00:02:55.530 --> 00:02:59.579
were to define it as plural and put user
profiles here then you would get an

00:02:59.579 --> 00:03:04.019
extra s here and I will link to the
documentation where you can find out how

00:03:04.019 --> 00:03:07.620
to override this behavior if you like

00:03:07.620 --> 00:03:09.989
okay so if we click on our user profiles

00:03:09.989 --> 00:03:15.599
model you can see that we have the user
profile that we created as our super

00:03:15.599 --> 00:03:21.720
user so every profile that we add in our
site will be accessible here in the

00:03:21.720 --> 00:03:23.460
Django admin

00:03:23.460 --> 00:03:27.090
if we click on our user
profile you can see that the

00:03:27.090 --> 00:03:32.220
first item is the password hash which is
the hashed version of our password

00:03:32.220 --> 00:03:35.310
notice that it didn't store it in clear
text because it stores it as an

00:03:35.310 --> 00:03:40.230
encrypted hash and then we also have the
last login the super user status and

00:03:40.230 --> 00:03:45.360
basically all of the fields that we have
available in our model

00:03:45.360 --> 00:03:46.260
okay so that's

00:03:46.260 --> 00:03:49.889
the Django admin now that we've enabled
it for our project let's go ahead and

00:03:49.889 --> 00:03:56.040
commit our latest changes to git so we
head back to the terminal or git bash

00:03:56.040 --> 00:04:03.989
I'm going to create a new tab here and I'm
going to do git add dot add any new files

00:04:03.989 --> 00:04:13.370
and then git commit - am and I'm going to
type enable Django admin for user

00:04:13.370 --> 00:04:21.800
profile model alright and then do git
push origin to push that up to github and

00:04:21.800 --> 00:04:27.800
there we have it we have enabled the
Django admin on our project

