Refactor entry_detail view to simplify JSON escaping logic
All checks were successful
Deploy to Server / deploy (push) Successful in 12s
All checks were successful
Deploy to Server / deploy (push) Successful in 12s
This commit is contained in:
parent
b0b7c4a0fe
commit
668526229d
1 changed files with 1 additions and 2 deletions
|
|
@ -66,11 +66,10 @@ def entry_detail(request: HttpRequest, feed_id: int, entry_id: int) -> HttpRespo
|
|||
entry: Entry = get_object_or_404(Entry, id=entry_id, feed=feed)
|
||||
|
||||
# Prepare entry data for display
|
||||
escaped_json: str | None = None
|
||||
if entry.data:
|
||||
formatted_json: str = json.dumps(entry.data, indent=2, ensure_ascii=False)
|
||||
escaped_json: str | None = html.escape(formatted_json)
|
||||
else:
|
||||
escaped_json: str | None = None
|
||||
|
||||
context = {
|
||||
"feed": feed,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue