0

Django 3: I have a Django Project and i want to modeify the admin page. I can edit the base.html for the admin page. Now i want to pass some context from my models to the base.html.

How can i do that? Any ideas?

Make UP
  • 1
  • 1
  • Can you explain more, what do you want to add to the context? – NKSM Apr 09 '21 at 15:59
  • You can write custom context processor (see https://docs.djangoproject.com/en/3.1/ref/templates/api/#writing-your-own-context-processors or https://stackoverflow.com/questions/17901341/django-how-to-make-a-variable-available-to-all-templates) in the context processor you can check the request path and narrow down action to admin pages. – Paweł Kordowski Apr 09 '21 at 15:45
  • So we know that we can add context to templates. And that we can get the context data from the models. Now i have a template for the admin page and i created a model. Now i want to get the models data and add that to the admin page as context. The Context Processor worked for me, but is there another way? – Make UP Apr 16 '21 at 13:54

0 Answers0