def post(self, request, *args, **kwargs):
    try:
        uploaded_file = request.FILES['uploaded_file']
    except KeyError:
        return HttpResponseRedirect(self.success_url)
    else:
        import_tmpfile_name = handle_uploaded_file(uploaded_file)
    for (import_key, import_plugin) in get_plugins('PROJECT_IMPORTS').items():
        import_plugin.file_name = import_tmpfile_name
        if import_plugin.check():
            try:
                import_plugin.process()
            except ValidationError as e:
                return render(request, 'core/error.html', {'title': _('Import error'), 'errors': e}, status=400)
            request.session['create_import_tmpfile_name'] = import_tmpfile_name
            request.session['create_import_key'] = import_key
            return render(request, 'projects/project_upload.html', {'create': True, 'file_name': uploaded_file.name, 'project': import_plugin.project, 'values': import_plugin.values, 'snapshots': import_plugin.snapshots, 'tasks': import_plugin.tasks, 'views': import_plugin.views})
    return render(request, 'core/error.html', {'title': _('Import error'), 'errors': [_('Files of this type cannot be imported.')]}, status=400)
def post(self, request, *args, **kwargs):
    try:
        uploaded_file = request.FILES['uploaded_file']
    except KeyError:
        return HttpResponseRedirect(self.success_url)
    else:
        import_tmpfile_name = handle_uploaded_file(uploaded_file)
    for (import_key, import_plugin) in get_plugins('PROJECT_IMPORTS').items():
        import_plugin.file_name = import_tmpfile_name
        if import_plugin.check():
            try:
                import_plugin.process()
            except ValidationError as e:
                return render(request, 'core/error.html', {'title': _('Import error'), 'errors': e}, status=400)
            request.session['create_import_tmpfile_name'] = import_tmpfile_name
            request.session['create_import_key'] = import_key
            return render(request, 'projects/project_upload.html', {'create': True, 'file_name': uploaded_file.name, 'project': import_plugin.project, 'values': import_plugin.values, 'snapshots': import_plugin.snapshots, 'tasks': import_plugin.tasks, 'views': import_plugin.views})
    return render(request, 'core/error.html', {'title': _('Import error'), 'errors': [_('Files of this type cannot be imported.')]}, status=400)