#100DaysOfWeb in Python Transcripts
Chapter: Days 45-48: Build a simple Django app
Lecture: Add the quotes app to Django's admin interface
0:01 This last video I want to show you the admin backend.
0:06 To start off this module, we define the admin site
0:10 of my-backend, so that's why admin
0:13 is not responding.
0:15 And I did that, a bit of a best security practice
0:18 because admin is the default in Django
0:20 it's also easier to guess.
0:24 First let's make a super user
0:25 which is a special user that has the greatest level
0:29 of permissions on Django
0:31 which will be able to access the backend.
0:34 In the root folder of my project
0:36 I'm going to use the manage.py utility again.
0:41 I have to enable my virtual environment.
0:49 And here's a create super user flag.
0:53 So I'm going to use that.
0:57 Going to leave it as pybite.
1:03 Set a password. And that's it.
1:10 Now when I go to Django backend
1:12 I can log in with that user.
1:18 Right, now the thing is that we have the default
1:21 groups and user models, which came with Django.
1:26 There we have the users that are in the system.
1:28 This is the user I just created.
1:30 And I see that it has staff status enabled
1:33 so it means that I can use the backend.
1:37 Actually have staff status and super user status.
1:41 So as staff I can log into the admin side
1:44 but I gave myself super user access
1:47 to get all the information, so that's the difference.
1:50 The only thing what I want highlight in this video
1:53 is that we don't have quotes here.
1:55 And that's because we have not filled in any code
1:58 for the admin.py file. So let's do that now.
2:02 Go into my app. And admin is blank.
2:06 And to add the quotes app to Django admin backend
2:10 it's actually very easy, just have to import a model.
2:16 And do an admin side register of the model.
2:22 And you can actually do a lot more here
2:24 but that's beyond the scope of this video.
2:26 This is the bare minimum to get a model working
2:30 in the admin backend.
2:33 So refresh and there you go.
2:35 Here we have the app and here we have the model.
2:37 So you could have various models under each app.
2:43 So here's the before.
2:46 And I can just update stuff here as if I were
2:49 at the front end, but here I'm doing it
2:51 at the backend as an admin user.
2:54 You can delete it.
2:56 I can add, et cetera.
2:59 So that's the admin backend and how you add
3:02 apps to this interface.
3:05 And that concludes the second set of videos
3:08 for Django module.