Welcome back, everyone.
In this lecture, we're going to go through a quick admin setup.
So we'll register our models, create a super user to manage everything from the admin side, and then
we'll create some example instances such as an actual book instance based off a book, author, language
and genre.
Let's head back to our code.
Okay.
So here we are back at Voice.
What I want to do is actually register the model, which means, as you may recall, we need to actually
go to admin that PI and register our models.
So we're going to say admin, dot, site, dot register.
And this is where we actually need to pass in the models.
So we'll need to import them, we'll say from that model's import and we have the author model, the
genre model, the language model, and then the book.
And book instance models will say book and book instance.
Okay.
And then we're simply going to register all of these.
So we're going to register the book.
The author, etc..
So now I'm going to say Amen.
That site, that register.
Then we're going to register the genre.
And I'm going to copy and paste this command so we don't keep repeating it and then we'll do language.
Then we'll do book.
And finally, we'll do a book instance.
Okay.
Go ahead and save that.
And then at the terminal, what we're going to do is create a super user.
So say Python.
Manage that pie.
Create Superuser.
And then follow the prompts here.
So I'll go ahead and just have this be called admin in lowercase.
And the email address can be anything admin at Edmunds.com.
And the password I'm simply going to use password.
So as we already know, this is going to just be invisible.
And then type in password again.
There we go.
Yes, I want to bypass that.
Okay.
There you go.
So let's go ahead and log into the admin portion of our site.
We'll say Python managed up high run server.
And then let me bring in our actual Web site.
So I'm going to control click.
Copy this.
Here we go.
And now we're going to go to.
The main page, except remember, we actually are not looking for the catalog page right now.
I want to go to my admin view.
Okay.
So let me also zoom out a little bit here.
So we're at the jingo view and we're actually going to say admin.
Password.
Lets log in and you can see everything that's here.
So what I want to do is get to a point where I can have one instance of a book.
So for that I need to add a language.
So we're going to add a language.
We're going to call it just English.
We'll say save.
Then I'm going to add a genre that I'm going to add a genre.
We'll call this genre mystery.
We'll save that.
Then I'm going to add a book.
The title can be something like Super Mystery.
Actually, we still need an author, so go ahead and add one right now.
So that actually opens up a new dialogue point.
So let's just say the author is Jose Portilla.
Date of birth should be today.
Save that.
Okay.
Summary.
Um.
Thunder read.
The ISBN number.
I'm just going to list one, two, three, four, five, six, seven, eight, nine, ten, one, one.
I think that's 13.
There we go.
The mystery language is English.
Let's save an ISBN number and it looks like we're good.
Okay, so super mystery was added successfully.
So now in the catalog, I should be able to create an instance of a book.
So I'm going to add a book.
And since we can see the unique ID is automatically filled out for us and this will be an instance of
super mystery.
If I wanted to imprint something there, like maybe torn pages or something like that.
I could do that.
As far as when it's due back.
I'm going to say it's due back, let's say tomorrow and then maintenance.
I can say it's on loan since it's now been taken away.
So we'll say save.
All right.
And it looks like everything's working on Django Edmonds side of things.
So we were able to actually create instances of an author, a book, genre, etc. of all those models
were able to actually log in and out.
And then up next, we need to do is start thinking about views and templates, etc. So we'll see that
in the very next lecture.