- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
The static files panel is rendering the used static files with empty href=""
attributes:

When functioning properly, it should look like:

Suggested solution:
staticfiles.py
def generate_stats(self, request, response): self.record_stats( { "num_found": self.num_found, "num_used": len(self.used_paths), # We can't store a dataclass, so we should convert it to a dictionary when it gets stored. "staticfiles": [{**vars(staticfile), "real_path": staticfile.real_path()} for staticfile in sorted(self.used_paths)], "staticfiles_apps": self.get_staticfiles_apps(), "staticfiles_dirs": self.get_staticfiles_dirs(), "staticfiles_finders": self.get_staticfiles_finders(), } )
staticfiles.html
<h4>{% blocktranslate count staticfiles_count=staticfiles|length %}Static file{% plural %}Static files{% endblocktranslate %}</h4> {% if staticfiles %} <dl> {% for staticfile in staticfiles %} {# Ideally we'd use remoteCall to inject the content, but for now let's open the content in a separate tab/window #} {# We also need to explicitly render the path as we want to see it. Not use the __str__ method #} <dt><strong><a class="toggleTemplate" target="_blank" href="{{ staticfile.url }}">{{ staticfile.path }}</a></strong></dt> <dd><samp>{{ staticfile.real_path }}</samp></dd> {% endfor %} </dl> {% else %} <p>{% translate "None" %}</p> {% endif %}