diff --git a/src/servala/frontend/forms/service.py b/src/servala/frontend/forms/service.py index d7ea60f..0afb1b5 100644 --- a/src/servala/frontend/forms/service.py +++ b/src/servala/frontend/forms/service.py @@ -1,6 +1,6 @@ from django import forms -from servala.core.models import CloudProvider, ServiceCategory +from servala.core.models import CloudProvider, ControlPlane, ServiceCategory class ServiceFilterForm(forms.Form): @@ -20,3 +20,11 @@ class ServiceFilterForm(forms.Form): offerings__control_planes__cloud_provider=cloud_provider ) return queryset + + +class ControlPlaneSelectForm(forms.Form): + control_plane = forms.ModelChoiceField(queryset=ControlPlane.objects.none()) + + def __init__(self, *args, planes=None, **kwargs): + super().__init__(*args, **kwargs) + self.fields["control_plane"].queryset = planes diff --git a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html index 1ed9a12..bd6a575 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html @@ -1,11 +1,23 @@ {% extends "frontend/base.html" %} {% load i18n %} {% load static %} +{% load partials %} {% block html_title %} {% block page_title %} {{ offering }} {% endblock page_title %} {% endblock html_title %} +{% partialdef service-form %} +{% if service_form %} + {% if form_error %} +
{% translate "Please choose your zone." %}
- {% else %} -- {% blocktranslate trimmed with zone=offering.control_planes.all.first.name %} - Your zone will be {{ zone }}. - {% endblocktranslate %} -
- {% endif %} -{% translate "We currently cannot offer this service, sorry!" %}
+ {% else %} + +