mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-31 18:27:30 +01:00
Add -t option to populate with test values, hide suggest changes button
This commit is contained in:
parent
98d37dfe21
commit
a5eb97e0af
@ -74,8 +74,9 @@
|
||||
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
||||
<li><a href="{{ package.getEditURL() }}">Edit</a></li>
|
||||
<li><a href="{{ package.getNewScreenshotURL() }}">Add screenshot</a></li>
|
||||
{% elif current_user.is_authenticated %}
|
||||
<li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Change</a></li>
|
||||
{% endif %}
|
||||
{% if current_user.is_authenticated %}
|
||||
<!-- <li><a href="{{ package.getCreateEditRequestURL() }}">Suggest Change</a></li> -->
|
||||
{% endif %}
|
||||
{% if package.checkPerm(current_user, "MAKE_RELEASE") %}
|
||||
<li><a href="{{ package.getCreateReleaseURL() }}">Create Release</a></li>
|
||||
|
77
setup.py
77
setup.py
@ -20,25 +20,11 @@ import os, sys, datetime
|
||||
if not "FLASK_CONFIG" in os.environ:
|
||||
os.environ["FLASK_CONFIG"] = "../config.cfg"
|
||||
|
||||
delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
|
||||
|
||||
if delete_db and os.path.isfile("db.sqlite"):
|
||||
os.remove("db.sqlite")
|
||||
|
||||
if not os.path.isfile("db.sqlite"):
|
||||
from app.models import *
|
||||
|
||||
print("Creating database tables...")
|
||||
db.create_all()
|
||||
print("Filling database...")
|
||||
|
||||
ruben = User("rubenwardy")
|
||||
ruben.github_username = "rubenwardy"
|
||||
ruben.forums_username = "rubenwardy"
|
||||
ruben.rank = UserRank.ADMIN
|
||||
db.session.add(ruben)
|
||||
test_data = len(sys.argv) >= 2 and sys.argv[1].strip() == "-t"
|
||||
|
||||
from app.models import *
|
||||
|
||||
def defineDummyData(licenses, tags, ruben):
|
||||
ez = User("Shara")
|
||||
ez.github_username = "Ezhh"
|
||||
ez.forums_username = "Shara"
|
||||
@ -52,24 +38,6 @@ if not os.path.isfile("db.sqlite"):
|
||||
jeija.github_username = "Jeija"
|
||||
db.session.add(jeija)
|
||||
|
||||
tags = {}
|
||||
for tag in ["Inventory", "Mapgen", "Building", \
|
||||
"Mobs and NPCs", "Tools", "Player effects", \
|
||||
"Environment", "Transport", "Maintenance", "Plants and farming", \
|
||||
"PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
|
||||
row = Tag(tag)
|
||||
tags[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
|
||||
licenses = {}
|
||||
for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
|
||||
"Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
|
||||
"CC-BY", "CC-BY-NC-SA", "MIT", "ZLib"]:
|
||||
row = License(license)
|
||||
licenses[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
|
||||
mod = Package()
|
||||
mod.approved = True
|
||||
@ -346,6 +314,39 @@ Uses the CTF PvP Engine.
|
||||
rel.approved = True
|
||||
db.session.add(rel)
|
||||
|
||||
db.session.commit()
|
||||
else:
|
||||
print("Database already exists")
|
||||
|
||||
delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
|
||||
if delete_db and os.path.isfile("db.sqlite"):
|
||||
os.remove("db.sqlite")
|
||||
|
||||
print("Creating database tables...")
|
||||
db.create_all()
|
||||
print("Filling database...")
|
||||
|
||||
ruben = User("rubenwardy")
|
||||
ruben.github_username = "rubenwardy"
|
||||
ruben.forums_username = "rubenwardy"
|
||||
ruben.rank = UserRank.ADMIN
|
||||
db.session.add(ruben)
|
||||
|
||||
tags = {}
|
||||
for tag in ["Inventory", "Mapgen", "Building", \
|
||||
"Mobs and NPCs", "Tools", "Player effects", \
|
||||
"Environment", "Transport", "Maintenance", "Plants and farming", \
|
||||
"PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
|
||||
row = Tag(tag)
|
||||
tags[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
licenses = {}
|
||||
for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
|
||||
"Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
|
||||
"CC-BY", "CC-BY-NC-SA", "MIT", "ZLib"]:
|
||||
row = License(license)
|
||||
licenses[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
if test_data:
|
||||
defineDummyData(licenses, tags, ruben)
|
||||
|
||||
db.session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user