Add very bare service instance list
This commit is contained in:
parent
2fd28e7afa
commit
bef41ac4f0
4 changed files with 41 additions and 1 deletions
|
@ -0,0 +1,13 @@
|
|||
{% extends "frontend/base.html" %}
|
||||
{% block content %}
|
||||
<h1>Service Instances for {{ organization.name }}</h1>
|
||||
<ul>
|
||||
{% for instance in instances %}
|
||||
<li>
|
||||
<a href="{{ instance.urls.base }}">{{ instance.name }}</a>
|
||||
</li>
|
||||
{% empty %}
|
||||
<li>No service instances found.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -40,6 +40,11 @@ urlpatterns = [
|
|||
views.OrganizationDashboardView.as_view(),
|
||||
name="organization.dashboard",
|
||||
),
|
||||
path(
|
||||
"instances/",
|
||||
views.ServiceInstanceListView.as_view(),
|
||||
name="organization.instances",
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
|
|
|
@ -5,7 +5,12 @@ from .organization import (
|
|||
OrganizationDashboardView,
|
||||
OrganizationUpdateView,
|
||||
)
|
||||
from .service import ServiceDetailView, ServiceListView, ServiceOfferingDetailView
|
||||
from .service import (
|
||||
ServiceDetailView,
|
||||
ServiceInstanceListView,
|
||||
ServiceListView,
|
||||
ServiceOfferingDetailView,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"IndexView",
|
||||
|
@ -14,6 +19,7 @@ __all__ = [
|
|||
"OrganizationDashboardView",
|
||||
"OrganizationUpdateView",
|
||||
"ServiceDetailView",
|
||||
"ServiceInstanceListView",
|
||||
"ServiceListView",
|
||||
"ServiceOfferingDetailView",
|
||||
"ProfileView",
|
||||
|
|
|
@ -143,3 +143,19 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView
|
|||
# If the form is not valid or if the service creation failed, we render it again
|
||||
context["service_form"] = form
|
||||
return self.render_to_response(context)
|
||||
|
||||
|
||||
class ServiceInstanceListView(OrganizationViewMixin, ListView):
|
||||
template_name = "frontend/organizations/service_instances.html"
|
||||
context_object_name = "instances"
|
||||
model = ServiceInstance
|
||||
permission_type = "view"
|
||||
|
||||
def get_queryset(self):
|
||||
"""Return all service instances for the current organization."""
|
||||
return ServiceInstance.objects.filter(organization=self.request.organization)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["organization"] = self.request.organization
|
||||
return context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue