Service instantiation #31

Merged
rixx merged 37 commits from 24-service-instantiation into main 2025-04-04 10:57:29 +00:00
Showing only changes of commit 174837a870 - Show all commits

View file

@ -133,8 +133,32 @@ class CrdModelFormMixin:
for field in ("organization", "context"): for field in ("organization", "context"):
self.fields[field].widget = forms.HiddenInput() self.fields[field].widget = forms.HiddenInput()
# self.fields["apiVersion"].disabled = True
# self.fields["kind"].disabled = True def get_nested_data(self):
"""
Builds the original nested JSON structure from flat form data.
Form fields are named with dot notation (e.g., 'spec.replicas')
"""
result = {}
for field_name, value in self.cleaned_data.items():
if value is None or value == "":
continue
parts = field_name.split(".")
current = result
# Navigate through the nested structure
for i, part in enumerate(parts):
if i == len(parts) - 1:
# Last part, set the value
current[part] = value
else:
# Create nested dict if it doesn't exist
if part not in current:
current[part] = {}
current = current[part]
return result
def generate_model_form_class(model): def generate_model_form_class(model):