So I am currently working on a rather Django Project. Since I didn´t start the project and am basically just extending the existing code I am not quite sure if my inputs are blocked through some sort of other configuration but my quite basic task doesnt give me the expected result.
So my Main Screen consists of three different templates which are the HomeView and the RootView (which includes the "menu_main" & the "menu_topbar).
My goal is to pass context to the menu_main but since it doesn´t have its own view I can´t seem to make it work.
The RootView is quite basic and looks like this:
class RootView(StrongholdPublicMixin, SimpleView):
extra_context = {'home_view': setting_home_view.value}
template_name = 'appearance/root.html'
def get_extra_context(self):
context = super().get_extra_context()
context.update(
{
'tree_data': Cabinet.objects.all(),
})
return context
While the context is added to the RootView I cannot seem to pass it to the menu_main (I need the List which is assigned to "tree_data"). I also tried changing my include of the menu_main to "% include 'appearance/menu_main.html' with sample="WORKING" %}" simply adding the "with ...etc." to it but I am not able to access the sample variable in menu_main.
In the RootView HTML-File the menu_main include would look like this:
<div id="menu-main">
{% include 'appearance/menu_main.html' with sample="WORKING" %}
</div>
Interestingly enough, if I remove the "menu-main" id from the div it seems to pass the variables just fine but I couldnt explain why the css would cause such a problem, so there has to be a different configuration that interferes.