1
00:00:06,390 --> 00:00:07,350
Welcome back, everyone.

2
00:00:07,380 --> 00:00:09,960
In this lecture, we're going to go through a quick admin setup.

3
00:00:10,620 --> 00:00:15,720
So we'll register our models, create a super user to manage everything from the admin side, and then

4
00:00:15,720 --> 00:00:21,390
we'll create some example instances such as an actual book instance based off a book, author, language

5
00:00:21,390 --> 00:00:21,990
and genre.

6
00:00:22,380 --> 00:00:23,880
Let's head back to our code.

7
00:00:25,870 --> 00:00:26,200
Okay.

8
00:00:26,200 --> 00:00:28,480
So here we are back at Voice.

9
00:00:28,930 --> 00:00:33,880
What I want to do is actually register the model, which means, as you may recall, we need to actually

10
00:00:33,880 --> 00:00:37,450
go to admin that PI and register our models.

11
00:00:37,630 --> 00:00:42,100
So we're going to say admin, dot, site, dot register.

12
00:00:42,430 --> 00:00:44,260
And this is where we actually need to pass in the models.

13
00:00:44,350 --> 00:00:50,920
So we'll need to import them, we'll say from that model's import and we have the author model, the

14
00:00:50,920 --> 00:00:54,400
genre model, the language model, and then the book.

15
00:00:55,380 --> 00:00:59,250
And book instance models will say book and book instance.

16
00:00:59,620 --> 00:00:59,940
Okay.

17
00:01:00,330 --> 00:01:02,910
And then we're simply going to register all of these.

18
00:01:03,360 --> 00:01:05,220
So we're going to register the book.

19
00:01:06,350 --> 00:01:07,430
The author, etc..

20
00:01:08,390 --> 00:01:09,530
So now I'm going to say Amen.

21
00:01:09,560 --> 00:01:11,150
That site, that register.

22
00:01:12,380 --> 00:01:13,820
Then we're going to register the genre.

23
00:01:15,140 --> 00:01:21,290
And I'm going to copy and paste this command so we don't keep repeating it and then we'll do language.

24
00:01:24,420 --> 00:01:25,410
Then we'll do book.

25
00:01:27,550 --> 00:01:29,770
And finally, we'll do a book instance.

26
00:01:31,560 --> 00:01:31,780
Okay.

27
00:01:31,880 --> 00:01:33,450
Go ahead and save that.

28
00:01:34,200 --> 00:01:38,040
And then at the terminal, what we're going to do is create a super user.

29
00:01:38,640 --> 00:01:39,690
So say Python.

30
00:01:40,650 --> 00:01:41,700
Manage that pie.

31
00:01:42,120 --> 00:01:43,350
Create Superuser.

32
00:01:44,640 --> 00:01:45,960
And then follow the prompts here.

33
00:01:46,350 --> 00:01:50,040
So I'll go ahead and just have this be called admin in lowercase.

34
00:01:51,180 --> 00:01:54,390
And the email address can be anything admin at Edmunds.com.

35
00:01:55,290 --> 00:01:57,780
And the password I'm simply going to use password.

36
00:01:57,870 --> 00:02:01,710
So as we already know, this is going to just be invisible.

37
00:02:02,670 --> 00:02:04,320
And then type in password again.

38
00:02:05,400 --> 00:02:05,880
There we go.

39
00:02:07,110 --> 00:02:08,910
Yes, I want to bypass that.

40
00:02:09,360 --> 00:02:09,660
Okay.

41
00:02:09,750 --> 00:02:10,169
There you go.

42
00:02:10,590 --> 00:02:15,210
So let's go ahead and log into the admin portion of our site.

43
00:02:15,360 --> 00:02:18,660
We'll say Python managed up high run server.

44
00:02:19,670 --> 00:02:22,770
And then let me bring in our actual Web site.

45
00:02:22,790 --> 00:02:25,850
So I'm going to control click.

46
00:02:25,850 --> 00:02:26,510
Copy this.

47
00:02:28,120 --> 00:02:28,630
Here we go.

48
00:02:29,600 --> 00:02:31,850
And now we're going to go to.

49
00:02:33,590 --> 00:02:38,000
The main page, except remember, we actually are not looking for the catalog page right now.

50
00:02:38,390 --> 00:02:40,340
I want to go to my admin view.

51
00:02:42,010 --> 00:02:42,370
Okay.

52
00:02:42,670 --> 00:02:45,100
So let me also zoom out a little bit here.

53
00:02:45,550 --> 00:02:48,520
So we're at the jingo view and we're actually going to say admin.

54
00:02:50,350 --> 00:02:50,980
Password.

55
00:02:51,910 --> 00:02:55,090
Lets log in and you can see everything that's here.

56
00:02:55,390 --> 00:02:59,050
So what I want to do is get to a point where I can have one instance of a book.

57
00:02:59,440 --> 00:03:01,210
So for that I need to add a language.

58
00:03:01,220 --> 00:03:02,410
So we're going to add a language.

59
00:03:03,160 --> 00:03:04,390
We're going to call it just English.

60
00:03:05,260 --> 00:03:06,010
We'll say save.

61
00:03:06,860 --> 00:03:10,340
Then I'm going to add a genre that I'm going to add a genre.

62
00:03:10,790 --> 00:03:12,770
We'll call this genre mystery.

63
00:03:14,400 --> 00:03:15,450
We'll save that.

64
00:03:16,170 --> 00:03:18,270
Then I'm going to add a book.

65
00:03:18,930 --> 00:03:21,630
The title can be something like Super Mystery.

66
00:03:23,460 --> 00:03:26,880
Actually, we still need an author, so go ahead and add one right now.

67
00:03:27,210 --> 00:03:29,580
So that actually opens up a new dialogue point.

68
00:03:30,120 --> 00:03:32,760
So let's just say the author is Jose Portilla.

69
00:03:33,840 --> 00:03:35,310
Date of birth should be today.

70
00:03:36,090 --> 00:03:36,690
Save that.

71
00:03:37,290 --> 00:03:37,710
Okay.

72
00:03:38,100 --> 00:03:38,730
Summary.

73
00:03:39,000 --> 00:03:39,480
Um.

74
00:03:39,990 --> 00:03:40,620
Thunder read.

75
00:03:41,600 --> 00:03:42,890
The ISBN number.

76
00:03:43,220 --> 00:03:50,640
I'm just going to list one, two, three, four, five, six, seven, eight, nine, ten, one, one.

77
00:03:50,690 --> 00:03:51,800
I think that's 13.

78
00:03:51,800 --> 00:03:52,280
There we go.

79
00:03:52,670 --> 00:03:54,620
The mystery language is English.

80
00:03:54,950 --> 00:03:59,330
Let's save an ISBN number and it looks like we're good.

81
00:03:59,510 --> 00:04:01,820
Okay, so super mystery was added successfully.

82
00:04:02,390 --> 00:04:06,740
So now in the catalog, I should be able to create an instance of a book.

83
00:04:07,280 --> 00:04:08,540
So I'm going to add a book.

84
00:04:08,550 --> 00:04:13,670
And since we can see the unique ID is automatically filled out for us and this will be an instance of

85
00:04:13,670 --> 00:04:14,510
super mystery.

86
00:04:14,870 --> 00:04:19,880
If I wanted to imprint something there, like maybe torn pages or something like that.

87
00:04:20,209 --> 00:04:20,839
I could do that.

88
00:04:21,529 --> 00:04:23,030
As far as when it's due back.

89
00:04:23,150 --> 00:04:28,840
I'm going to say it's due back, let's say tomorrow and then maintenance.

90
00:04:28,850 --> 00:04:32,080
I can say it's on loan since it's now been taken away.

91
00:04:32,090 --> 00:04:32,960
So we'll say save.

92
00:04:33,740 --> 00:04:34,070
All right.

93
00:04:34,310 --> 00:04:37,700
And it looks like everything's working on Django Edmonds side of things.

94
00:04:38,060 --> 00:04:42,710
So we were able to actually create instances of an author, a book, genre, etc. of all those models

95
00:04:43,070 --> 00:04:44,900
were able to actually log in and out.

96
00:04:45,050 --> 00:04:50,300
And then up next, we need to do is start thinking about views and templates, etc. So we'll see that

97
00:04:50,300 --> 00:04:51,260
in the very next lecture.

