DEV Community

Connor Bode
Connor Bode

Posted on

3 1

What context gets passed to Django Admin template

So I'm modding Django Admin, like heavy.

It's fun. I really love the platform. You can bust out a dashboard, like lightning fast.

Anyways, enough chit-chat.

Let's say you're editing the change_form.html template. (you know, the one that lets you change an instance of a model), and you want to know what context variables get passed to that template.

If you're like me, you head over to Django's Github repo and grab the contents of the default change_form.html.

Then, you want to know what context gets passed down to the template. Here's what you do:

  1. Find a variable in the template. I just spotted is_popup.
  2. Use Github's search bar to find instances of is_popup in the Django repo:
  3. Notice that the first result has the word context kicking around.. probably a good bet.
  4. Click through to the result, and you'll see the full context for the view getting built

✌️ that's it for now, hope this tip will help you!


I can be found on Twitter @connorbode or at matix.io, where I write code.

Come say hi πŸ‘‹!

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay