Add organization data serialization to OrgDetailView

This commit is contained in:
Joakim Hellsén 2025-09-03 17:23:59 +02:00
commit 0322744104
2 changed files with 10 additions and 0 deletions

View file

@ -34,4 +34,5 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<pre><code>{{ org_data }}</code></pre>
{% endblock content %} {% endblock content %}

View file

@ -63,9 +63,18 @@ class OrgDetailView(DetailView):
games: QuerySet[Game, Game] = organization.games.all() # pyright: ignore[reportAttributeAccessIssue] games: QuerySet[Game, Game] = organization.games.all() # pyright: ignore[reportAttributeAccessIssue]
serialized_org = serialize(
"json",
[organization],
fields=("name",),
)
org_data = json.loads(serialized_org)
pretty_org_data = json.dumps(org_data[0], indent=4)
context.update({ context.update({
"subscription": subscription, "subscription": subscription,
"games": games, "games": games,
"org_data": pretty_org_data,
}) })
return context return context