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() }}" />
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||||
<select name="action">
|
<select name="action">
|
||||||
<option value="importusers" selected>Create users from mod list</option>
|
<option value="importusers" selected>Create users from mod list</option>
|
||||||
|
<option value="importscreenshots">Import screenshots from VCS</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="Start" />
|
<input type="submit" value="Start" />
|
||||||
</form>
|
</form>
|
||||||
|
@ -3,6 +3,7 @@ from flask_user import *
|
|||||||
from flask.ext import menu
|
from flask.ext import menu
|
||||||
from app import app
|
from app import app
|
||||||
from app.models import *
|
from app.models import *
|
||||||
|
from app.tasks.importtasks import importRepoScreenshot
|
||||||
from app.tasks.forumtasks import importUsersFromModList
|
from app.tasks.forumtasks import importUsersFromModList
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import *
|
from wtforms import *
|
||||||
@ -18,6 +19,14 @@ def admin_page():
|
|||||||
if action == "importusers":
|
if action == "importusers":
|
||||||
task = importUsersFromModList.delay()
|
task = importUsersFromModList.delay()
|
||||||
return redirect(url_for("check_task", id=task.id, r=url_for("user_list_page")))
|
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:
|
else:
|
||||||
flash("Unknown action: " + action, "error")
|
flash("Unknown action: " + action, "error")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user