Create inheritance graphs/trees for Django templates

2024/9/20 19:41:44

Is there any tool out there that would take a directory with a Django application, scan it for templates and draw/print/list a hierarchy of inheritance between templates?

Seeing which blocks are being overridden at every level would be an especially helpful feature in such a tool.

Answer

Old question but FWIW there is (or was) django-template-graph that should work with Django 1.7.

It doesn't (yet) work with Django 1.8+ when the template logic changed a bit so it needs to be patched, I opened an issue for that and will probably release a fix soon.

https://en.xdnf.cn/q/72313.html

Related Q&A

Python SVG converter creates empty file

I have some code below that is supposed to convert a SVG image to a PNG. It runs without errors but creates a PNG file that is blank instead of one with the same image as the original SVG. I did find t…

Fastest way to iterate through a pandas dataframe?

How do I run through a dataframe and return only the rows which meet a certain condition? This condition has to be tested on previous rows and columns. For example:#1 #2 #3 #4 1/1/1999 4 …

Constraints do not follow DCP rules in CVXPY

I want to solve this problem using CVXPY but I dont know why I get the following error message:DCPError: Problem does not follow DCP rules. I guess my constraints are not DCP. Is there any way to model…

is this betweenness calculation correct?

I try to calculate betweenness for all nodes for the path from 2 to 6 in this simple graph.G=nx.Graph() edge=[(1,5),(2,5),(3,5),(4,5),(4,6),(5,7),(7,6)] G.add_edges_from(edge) btw=nx.betweenness_centra…

Why does PIL thumbnail not resizing correctly?

I am trying to create and save a thumbnail image when saving the original user image in the userProfile model in my project, below is my code:def save(self, *args, **kwargs):super(UserProfile, self).sa…

Put the legend of pandas bar plot with secondary y axis in front of bars

I have a pandas DataFrame with a secondary y axis and I need a bar plot with the legend in front of the bars. Currently, one set of bars is in front of the legend. If possible, I would also like to pla…

Printing floats with a specific number of zeros

I know how to control the number of decimals, but how do I control the number of zeros specifically?For example:104.06250000 -> 104.0625 119.00000 -> 119.0 72.000000 -> 72.0

How do I make a matplotlib scatter plot square?

In gnuplot I can do this to get a square plot:set size squareWhat is the equivalent in matplotlib? I have tried this:import matplotlib matplotlib.use(Agg) import matplotlib.pyplot as plt plt.rcParams[…

Efficiently determining if a business is open or not based on store hours

Given a time (eg. currently 4:24pm on Tuesday), Id like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for ev…

parsing .xsd in python

I need to parse a file .xsd in Python as i would parse an XML. I am using libxml2. I have to parse an xsd that look as follow: <xs:complexType name="ClassType"> <xs:sequence><x…