import os import platform from django import get_version as django_version from django.shortcuts import render from django.utils import timezone from .models import CareerPath, Skill # Import the new models def home(request): """Render the landing screen with loader and environment details.""" host_name = request.get_host().lower() agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" now = timezone.now() context = { "project_name": "New Style", "agent_brand": agent_brand, "django_version": django_version(), "python_version": platform.python_version(), "current_time": now, "host_name": host_name, "project_description": os.getenv("PROJECT_DESCRIPTION", ""), "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), } return render(request, "core/index.html", context) def career_explorer_view(request): """Render the career explorer page with all career paths and skills.""" career_paths = CareerPath.objects.all().prefetch_related('required_skills') skills = Skill.objects.all() context = { 'career_paths': career_paths, 'skills': skills, } return render(request, 'core/career_explorer.html', context) from django.contrib.auth.decorators import login_required from django.shortcuts import redirect from .forms import StudentProfileForm from .models import StudentProfile @login_required def student_profile_view(request): try: student_profile = request.user.studentprofile except StudentProfile.DoesNotExist: student_profile = None if request.method == 'POST': form = StudentProfileForm(request.POST, instance=student_profile) if form.is_valid(): profile = form.save(commit=False) profile.user = request.user profile.save() return redirect('student_profile') # Redirect to the same page or a success page else: form = StudentProfileForm(instance=student_profile) context = { 'form': form, 'student_profile': student_profile } return render(request, 'core/student_profile_form.html', context)