def index(request): ctx = { 'form_add_host': HostForm(), 'form_create_container': CreateContainerForm(), 'form_import_repository': ImportRepositoryForm(), 'form_build_image': ImageBuildForm(), } return render_to_response('dashboard/index.html', ctx, context_instance=RequestContext(request))
def import_image(request): form = ImportRepositoryForm(request.POST) hosts = form.data.getlist('hosts') for i in hosts: host = Host.objects.get(id=i) args = (form.data.get('repository'),) utils.get_queue('shipyard').enqueue(host.import_image, args=args, timeout=3600) messages.add_message(request, messages.INFO, _('Importing') + ' {0}'.format( form.data.get('repository')) + '. ' + _('This may take a few minutes.')) return redirect('containers.views.index')