mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Add import screenshots admin action
This commit is contained in:
parent
dbc56283eb
commit
cfb92273ff
@ -17,6 +17,7 @@
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<select name="action">
|
||||
<option value="importusers" selected>Create users from mod list</option>
|
||||
<option value="importscreenshots">Import screenshots from VCS</option>
|
||||
</select>
|
||||
<input type="submit" value="Start" />
|
||||
</form>
|
||||
|
@ -3,7 +3,8 @@ from flask_user import *
|
||||
from flask.ext import menu
|
||||
from app import app
|
||||
from app.models import *
|
||||
from app.tasks.forumtasks import importUsersFromModList
|
||||
from app.tasks.importtasks import importRepoScreenshot
|
||||
from app.tasks.forumtasks import importUsersFromModList
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import *
|
||||
from app.utils import loginUser, rank_required
|
||||
@ -18,6 +19,14 @@ def admin_page():
|
||||
if action == "importusers":
|
||||
task = importUsersFromModList.delay()
|
||||
return redirect(url_for("check_task", id=task.id, r=url_for("user_list_page")))
|
||||
elif action == "importscreenshots":
|
||||
packages = Package.query \
|
||||
.outerjoin(PackageScreenshot, Package.id==PackageScreenshot.package_id) \
|
||||
.filter(PackageScreenshot.id==None).all()
|
||||
for package in packages:
|
||||
importRepoScreenshot.delay(package.id)
|
||||
|
||||
return redirect(url_for("admin_page"))
|
||||
else:
|
||||
flash("Unknown action: " + action, "error")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user