feat(structure): Select and View an individual Organization

!1
This commit is contained in:
2024-05-07 05:59:37 +09:30
parent dd54eae8d7
commit 7cdfdab1fc
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,26 @@
{% extends 'base.html.j2' %}
{% block title %}{{ organization.name }}{% endblock %}
{% block body%}
<section class="content-header">
<fieldset><label>Name</label><input type="text" value="{{ organization.name }}" /></fieldset>
<fieldset><label>Created</label><input type="text" value="{{ organization.created }}" readonly /></fieldset>
<fieldset><label>Modified</label><input type="text" value="{{ organization.modified }}" readonly /></fieldset>
</section>
<table>
<tr>
<th>Name</th>
<th>Created</th>
<th>Modified</th>
</tr>
{% for tm in organization.teams.all %}
<tr>
<td>{{ tm.name }}</td>
<td>{{ tm.created }} </td>
<td>{{ tm.modified }} </td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -5,4 +5,5 @@ from . import views
app_name = "structure"
urlpatterns = [
path("", views.IndexView.as_view(), name="index"),
path("<int:pk>/", views.OrganizationView.as_view(), name="organization"),
]

View File

@ -13,3 +13,17 @@ class IndexView(generic.ListView):
def get_queryset(self):
return Organization.objects.filter(team=None)
class OrganizationView(generic.DetailView):
model = Organization
template_name = "structure/organization.html.j2"
# context_object_name = Team
def get_queryset(self):
"""
Excludes any questions that aren't published yet.
"""
return Organization.objects.filter()