Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new project using a single .zip file #917

Open
1 task done
Raruto opened this issue Jul 26, 2024 · 0 comments
Open
1 task done

Create a new project using a single .zip file #917

Raruto opened this issue Jul 26, 2024 · 0 comments
Assignees
Labels
feature New feature or request

Comments

@Raruto
Copy link
Contributor

Raruto commented Jul 26, 2024

Checklist

  • I've searched through the current issues to make sure this feature hasn't been requested already.

Motivation

Starting from: #881, we can create a new project using a shell command (or an automated script).

Now, it would be nice to be able to load a new project without forcing the user to go through the file manager.

That means, without forcing the user to make two separate uploads:

image

Suggested solution

A - ADMIN USER

1. create a zip file like the following: G3WSUITE_3.6.zip *

* organization of data and projects

2. upload it onto the "New QGIS project" form

image

B - SERVER SIDE

1. extract it into a temporary folder

import zipfile
from django.core.management import call_command

with zipfile.ZipFile(zip_file, 'r') as zip_ref:
    zip_ref.extractall("/tmp/new_project")

2. load the project

call_command('load_project', file="/tmp/new_project/demo.qgs", data="/tmp/new_project/projects_data/")

3. warn the user in case of file collisions (eg. within the "project_data" folder)

Alternatives considered

No response

@Raruto Raruto added the feature New feature or request label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants