Django-Admin-Deux: From First Steps to Custom Plugins
Published October 26, 2026
This video features Emma Delescolle at DjangoCon Europe 2024 in Vigo, Spain.
Talk: Django Classy All The Things!!! by Emma Delescolle
https://pretalx.evolutio.pt/
Python’s object model makes code highly introspectable: strings, functions, classes, and even built-in types are objects, with tools such as `dir()`, `__doc__`, `type`, MRO, and `inspect` revealing how they work. Emma connects this idea to Classy Class-Based Views (CCBV), which presents Django’s class-based views with inherited attributes, methods, docstrings, and source code in one place, making framework internals easier to understand than scattered base classes and mixins. She argues that this approach is useful beyond Django’s built-in views and demonstrates a tool for generating similar, offline HTML documentation for a project’s own models and other classes. The generated pages show fields, methods, inheritance details, source locations, and configurable exclusions for framework-provided or third-party components, so developers can inspect large codebases even when the Django development server is not running. She invites attendees to help improve and publish the tool.
Summarised automatically from the transcript.
Python provides introspection tools such as `dir`, `__doc__`, `type`, method resolution order, and the `inspect` module. These reveal an object’s members, documentation, type hierarchy, method lookup order, and other implementation details.
Discussed at 3:53CCBV is an interactive reference that shows a Django class-based view’s inherited attributes, properties, methods, docstrings, and source code. It makes the framework’s behavior easier to understand by solving the locality problem of implementations spread across base classes and mixins.
Discussed at 5:17Yes. Emma demonstrates a tool that generates Classy-style HTML documentation for a project’s models, fields, methods, and inheritance, with options to hide framework-provided members and configure documented modules and known apps.
Discussed at 12:18It is stored on disk so it remains available when the Django development server or the project itself is broken. You only need Python to serve the files with Python’s HTTP server.
Discussed at 18:00Automatically transcribed, so expect mistakes in names and technical terms.
Hello, my name is Emma and I've been doing Python and Django for quite a few years now. I'm Also, a proud member of the PSF as well as the DSF. And I co-founded a small company called Levit. And with Levit, we do a lot of data management for application, things like CRPs, CRMs. Things like a lot of other speakers on this stage this week have are doing. We're working on large applications. And this is going to be well in a couple minutes. Just a short disclaimer.
I don't have Karen 's ability to draw, nor could I find a lot of images that were really related to the topic On the internet, so I asked AI, I asked Crayon to help me find images for this talk. And I've had great success doing that before. I've if you've not seen my talk about the Raspberry Pi and a chipset on a Raspberry Pi. Raspberry Pi, try to imagine what AI would draw for a chipset on a Raspberry Pi. So for starters, I want to talk about mathematics. Mathematics is a language that is Created by humans but is the only language that can describe mathematics.
And mathematics is the base of our s our understanding of everything. Mathematics is the base of physics. Physics is the base for astrophysics. Everything is based on something that describes itself. And astrophysicists use math, but they also use another language that can be used to describe itself. It's Python. Python can be used to describe itself. This is the concept behind things like PyPy, Pyth Python interpreter written in Python. And the reason that Python can describe itself is because in Python everything is an object.
A string. And you can read this code, right? So in Python everything is an object. A string is an object. But literals like integers and booleans, they're also objects. Of course if you create your own class and you instantiate that class That's an object. The instance of the class is an object. But the class itself is also an object. It's an object of type. And objects, the built-in object in Python is also an object. That that's in the name it would it would it would be bad if
object was not an object. But object is a ty is an object of type and type itself is an object of type. And really when I say everything is an i is an object in Python, functions are objects also in Python. So if you're doing function based use because you don't like to do object oriented. Well I'm sorry to ruin your day, but you're doing class based use actually. I lost my mouse. Here. The nice things about objects is that objects can be introspected and they can be inspected.
You have things like dirt that will let you know all the properties, methods of an object. There is Dunder Doc that will let you read the docs that you vote for a function or any other type of object. There is type that will give you the parent class of an object. There is MRO that will let you know when you're going to call a method on an object. MRO is going to tell you, okay, I'm going to call the same method on this parent first and then on that other parent and on that class parent after. So all these things, all these tools are built into Python to let you understand how Python itself works, how your Python code works.
or the code that somebody else's wrote works. So Python even comes with specific modules that let you know more about your code or any code basically in Python. You can try importing inspect if you've never done that. Import inspect and then you can learn a lot of things about anything you want in any code base in Python. But what does it really have to do with the with the title of the talk? I mean the title of the talk was Classy All the Things.
Well the t the ta the title of the touch sorry. The title of the talk comes from this thing called classy class-based views. So, for those of you who don't know what classy class-based, Best views is this is what some people call the second documentation website of Django. It is a website that's oh that that is the AI generated image. This doesn't help you. This is a screenshot, it's better.
So this is a website that lets you learn about class based views in Django. And the problem with class based views is that if you are opening a template view for example when you're trying to understand what is going to be doing when you try to use it, there is not much in the in the template view itself, because all the code that's used to render a template view is It's spread onto other base classes, onto mix-ins and things like that. And Corton has told us, locality is something that is quite nice when you open a file you see everything that it does and it allows you to understand things.
This is something that we don't have out of the box with class based views. When you open a template view it I think it gives two methods. actually that you can that you can see in the class based view. Everything else is defined in other classes. So here CCB lets you inspect everything I'm trying I'm going to try to switch to a live view. So this is the actual website of class And if I scroll down to template viewers.
Now for this template view I'm able to see everything that is defined in a template view. I've got all the properties, the attributes, and if I scroll down I've also got all the methods that a class based view actually owns. And even if I click on one of those I lost my screen. Okay. If I click on one of those not only will it give me the doc string for that method, but it will also give me the code for that method. And as the person who did the talk about using and abusing the admin yesterday said,
digging to the code of the framework that you're using is something that is great. It's how you can learn about your framework, it's how you can have a deep insight on exactly how the framework that you're using is doing the things that you want it to do and it help often helps you find bugs more easily and things like that. So personally I find that this kind of tool is very useful and it fixes the locality problem. No if I crawl back if I scroll back up I see everything that that I want to know about this template view. And Apparently I'm not the only one who finds this interesting
Because once C B V was out, other people started doing the same thing with other part of Django. We have classy Django Rest framework. I'm I'm really not sure how the AI got this thing. But this is a representation of Class C DRF. And Class C DRF gives you the same kind of information except with serializer, view sets and that kind of thing. And there is also classy Django Forms.
This one is a bit clearer how we got there. Unfortunately classy Django Forms hasn't been updated in a while, it's still at Django tree. So it is still useful because the hierarchy of things hasn't changed that much, but it's not up to date anymore. And but once you start using that kind of documentation that kind of tool it it's more than documentation, it's a tool. It is it becomes similar to your own code editor. You know when you're in your editor and you jump to the definition of a of a method. This is this is what it does. And for
that reason s some people love it, love to have that kind of tool, to borrow that kind of tool. Some hate it because you shouldn't need a second documentation website. I'm part of the people who loves it because I use a lot of class-based things. Maybe soon I will be using class-based emails as well. Who knows? But I've been using it all the time. And I don't know what happened to that tiger. But I've I've been using it all the time. It has made my life so much easier. It has brought me a much better understanding of how Django's
internal works. But at the same time it has bought it has brought some frustration. I am frustrated because now I can see everything I want to see about Django class based views, but I don't really know anything about Django admin options or I don't really know anything about my own code or I can see an outdated version of what Django forms do, but I cannot see exactly what the latest version So I'm thinking, wouldn't it be great if I could have a Django classy
of my own codes? Because you know, remember I said we worked on large Spandish project. So when there's this project that has a hundred models, that has two hundred views, that has the same amount of serializers, and When I go back to that project six months later, do I always remember where I bought everything? Absolutely not. So th this is something that that that would really Help me. And could I could I really jangle class in my own form? Well
I kind of did a thing and I tried to type manage the bike. Classify and I got some results. And I'm going to try to show that to you. Can everybody well the text on the screen doesn't really doesn't really matter. But this is output that you can get without too much effort for your own for your own code. And this is
one of these projects that that I told you about. If I start scrolling down you can see that There's quite there's quite a few things in there. There's quite several models and things like that. And so now at this stage I don't really remember what's what's in my in my product model, but I can go there and I can have something similar to what C B V offers. And also I'm going to test it right here in front of you. I'm I'm a profound lover of dark mode for several reasons, but if you really want to have it in light mode
and be blinded by it, this is this is also available. So things Django and here I'm talking about models. I had to also make a few things. So CCBV tells you about the attributes and methods, but here we're seeing the code for a model. And models they have this extra thing that is called fields. So this is something that we can also have
as a separate thing. And here you can you can see the all the fields where they are actually defined in what file they are designed. And here we have some checkbox on the top where I can hide and show part of the code part of the output. So for example PK is defined by Django. Most of the time I'm not going to want to see PK as the l in the list of my fields because this is something defined by Django. I know there is a PK. So by default this is hidden. If I go see the methods, this is very similar to how CCBV works.
I can also click on it and have the Details I I'm clicking on my back in my back so I didn't pick something that has inheritance, but if it has inheritance and for example method is defined on several level. It will also give you every thing that defined that method before the class. So yeah, this is this is something that you can now do. And if I scroll back up you can you can see also that I've got a second checkbox. And this is a checkbox for DRS schema adapters, which is also something I built.
But you probably don't care But the R schema adapter because you might not have it in your code. So I'm also going to show you how I'm able to get that. There is a configuration settings where you can configure exactly what modules you want to document with that classifying tool. And you can also define some known apps, the thing at the bottom. And known apps is a dictionary of list and so you say that for example you want you're using wagtail and so you know that wagtail everything that's in the module wagtail triggered or model cluster this is part of wagtail and you don't want to document
So this is a known app and for every known app you will get a checkbox. This documentation is generated and it lives on your hard drive as HTML5. file it's not being served by the Django server. Let me get a drink. It's not generated it's not life with the Django server because I found out that the moment that I really, really want to know why that method where that method was defined and what it does exactly is when my code doesn't run. So I didn't want to depend on the on the Django
development server to serve that. So it's generated and lives on the hard drive. So even if your development server is completely crashed and nothing runs, you still have access to that documentation. All you need is to have Python, which you probably do if you're working on a Django project, and start Python's HTTP server. So if you want to if you want to see more of this and maybe help me to publish it to PyPi you can come this weekend at the sprint maybe suggest more improved And things.
But if not , right now it's time for questions.
June 5 - 9, 2024
Vigo, Spain
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026