export.py : Avoid conditional check in for loops
You have the same useless condition in each loop : For exemple:
for div in soup.find_all(attrs={"dj-load": True}):
if div:
forline = "{% load " + div.get('dj-load') + " %}"
div.insert_before(forline)
del div
The if div condition make no sense, you will have a div for each loop, or won't go inside the for loop if it won't find anything.
You can remove if condition for each loop.
I did it quickly in https://github.com/lingster/django-bootstrap-studio-tools/pull/9
ok, makes sense. However I think one of the problems with this script is that we don't have any test cases to verify if a particular change will continue to work or if something would break.
For sure, it will be nice to have some test, but actually I've no idea how to perform it to check generated content. I'm not able to provide it, and if no one plan to do this and if you won't import PR until you have test, it will be hard to move on :)
In the same idea you're performing some check like :
if "dj-for" in div.attrs:
It's useless because you're selecting tag according to their attribute, so it must have dj-for in his attribute dict.