def packages(request): """ Select packages and groups """ # Create the spin object here. # Some thought the secondary "basic" form was annoying, so I got rid of it. name = request.POST.get('name_of_the_spin') base_ks = request.POST.get('based_on') # Do a simple redirect if they accidentally skipped to this page if name == None or base_ks == None: return HttpResponseRedirect("/") spin = new_spin(name, base_ks) spin_id = spin.id language = request.POST.get('select_language') timezone = request.POST.get('select_timezone') # These should not be none either. if language == None or timezone == None: return HttpResponseRedirect("/") spin = add_lang_tz(spin_id, language, timezone) selected, plus, minus = default_selected(spin.baseks) c = get_comps() groups = package_listing(c) categories = c.get_categories() return render_to_response('packages.html', {'cats': categories, 'groups': groups, 'defaults': selected, 'spin': spin, 'plus': plus, 'minus': minus})
def basic(request): """ select template """ name = request.POST.get('name_of_the_spin') base_ks = request.POST.get('based_on') spin = new_spin(name, base_ks) defaults = get_lang_tz(base_ks) form = BasicForm(initial=defaults) return render_to_response('basic.html', {'form': form, 'spin': spin})
def packages(request): """ Select packages and groups """ # if the user is uploading their own kickstart file, toss it in a cache if request.FILES: handle_uploaded_ks(request.FILES['uploaded_kickstart']) # Create the spin object here. # Some thought the secondary "basic" form was annoying, so I got rid of it. name = request.POST.get('name_of_the_spin') base_ks = request.POST.get('based_on') # Do a simple redirect if they accidentally skipped to this page if name == None or base_ks == None: return HttpResponseRedirect("/") # if we hit this, it's because they uploaded their own kickstart file uploaded = False if base_ks == 'None': base_ks = os.path.join(settings.MEDIA_ROOT, request.FILES['uploaded_kickstart']._name) uploaded = True spin = new_spin(name, base_ks, uploaded) spin_id = spin.id language = request.POST.get('select_language') timezone = request.POST.get('select_timezone') # These should not be none either. if language == None or timezone == None: return HttpResponseRedirect("/") print spin.uploaded spin = add_lang_tz(spin_id, language, timezone) print spin.uploaded selected, plus, minus = default_selected(spin.baseks, spin.uploaded) c = get_comps() groups = package_listing(c) categories = c.get_categories() return render_to_response('packages.html', {'cats': categories, 'groups': groups, 'defaults': selected, 'spin': spin, 'plus': plus, 'minus': minus})