diff --git a/django_code/cloudmanager/views.py b/django_code/cloudmanager/views.py
index 616e7e0..9fa0670 100644
--- a/django_code/cloudmanager/views.py
+++ b/django_code/cloudmanager/views.py
@@ -1,4 +1,6 @@
from django.http import HttpResponse
+from django.views.decorators.http import require_POST
+#from django.contrib.auth.decorators import login_required # optional but recommended
def trigger_my_action(request):
# 1. Run your Django module/function
@@ -6,4 +8,26 @@ def trigger_my_action(request):
print('here')
# 2. Return ONLY the HTML fragment you want to show on the page
# This will replace the content inside the "hx-target" div
- return HttpResponse("Done!")
\ No newline at end of file
+ return HttpResponse("Done!")
+
+
+#@login_required
+@require_POST
+def change_schedule(request):
+ # HTMX sends these via standard POST data
+ schedule_id = request.POST.get('schedule_id')
+ server_name = request.POST.get('server_name')
+
+ if not schedule_id or not server_name:
+ return HttpResponse("Missing parameters.", status=400)
+
+ try:
+ # --- Your Core Logic Here ---
+ # e.g., Server.objects.filter(name=server_name).update(schedule_id=schedule_id)
+ print(f"Updating {server_name} to schedule profile {schedule_id}")
+
+ # Return a success message that will instantly inject into the server's status div
+ return HttpResponse("✓ Updated successfully!")
+
+ except Exception as e:
+ return HttpResponse(f"Error: {str(e)}", status=500)
\ No newline at end of file