g3w-admin
g3w-admin copied to clipboard
Create a new project using a single `.zip` file
Checklist
- [X] I've searched through the current issues to make sure this feature hasn't been requested already.
Motivation
Starting from: https://github.com/g3w-suite/g3w-admin/pull/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:
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
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