Django: Getting Started Transcripts
Chapter: Django Admin
Lecture: Admin intro
Login or purchase this course to watch this video and the rest of the course contents.
0:00 The Django admin is a package that ships with Django and gives you a web based interface to your models.
0:07 If you're okay with the interface being a little bit clunky you get a lot of code for free.
0:11 Stuff you would normally have to write yourself to manage your site and its data. This chapter concentrates on the Django admin.
0:18 But to do that first I need to take a little detour and talk about users The admin is behind a login wall so you'll need to know how to create
0:28 a user name and password to get through that wall. The Django admin is heavily customizable but by default is really intended for the site admins.
0:37 Hence its name. So that detour I mentioned, it is really going to focus just on super user accounts.
0:44 The bulk of this chapter will be talking about the Django admin itself and how you can modify your models to make it easier to navigate.
0:53 The screen in the admin you're likely to be using the most is called the change list. This is a listing of all the objects of a certain model,
1:00 i.e. the rows in the database. If you've got a lot of stuff in your database, this can be information overload.
1:07 So you can create filters to help you look at just a subset. Finally, the admin is just another web page.
1:13 So with a little bit of knowledge about how it works. You can parameterize links to get the view you want,
1:20 you've heard me mention before, how important it is to get your CRUD right. Still fun to say, CRUD is an acronym for all the operations you do on data,
1:30 create, read, update and delete. Think about a user in your system. You need a way to create new ones, allow them to read their profile,
1:41 update their profile, and if you're a social media site a way to lie to them about how you're deleting their data when they requested,
1:47 honest, honest you are because these operations need to be done on almost all data
1:52 It would be convenient if someone wrote some code that did this stuff. Django Admin goes a long way to covering your most frequent CRUD needs.
2:00 And because of the way models are defined, it takes very little extra Python to take advantage of it. As the models are a proxy to the database.
2:09 The Django admin really is a web based interface to your database or at least those parts of the database that you wish to expose.