From e25aaa5ec6ec1ef4c13d2ef3922779aa574a0d1a Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 25 Jun 2021 14:52:06 +0200 Subject: [PATCH] Admin page for checking skip IsA list --- matcher/model.py | 11 +++++++++++ templates/admin/skip_isa.html | 17 +++++++++++++++++ web_view.py | 5 +++++ 3 files changed, 33 insertions(+) create mode 100644 templates/admin/skip_isa.html diff --git a/matcher/model.py b/matcher/model.py index 1333267..796d28c 100644 --- a/matcher/model.py +++ b/matcher/model.py @@ -41,6 +41,11 @@ class Item(Base): if qid and len(qid) > 1 and qid[0].upper() == "Q" and qid[1:].isdigit(): return cls.query.get(qid[1:]) + @property + def wd_url(self): + return f"https://www.wikidata.org/wiki/{self.qid}" + + def get_claim(self, pid): return [i["mainsnak"]["datavalue"]["value"] if "datavalue" in i["mainsnak"] else None for i in self.claims.get(pid, [])] @@ -342,3 +347,9 @@ class ChangesetEdit(Base): changeset = relationship('Changeset', backref=backref('edits', lazy='dynamic')) + +class SkipIsA(Base): + __tablename__ = 'skip_isa' + item_id = Column(Integer, ForeignKey('item.item_id'), primary_key=True) + + item = relationship('Item') diff --git a/templates/admin/skip_isa.html b/templates/admin/skip_isa.html new file mode 100644 index 0000000..407a67c --- /dev/null +++ b/templates/admin/skip_isa.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block title %}{% endblock %} + +{% block content %} +
+ +

Skip instance of list

+ + + +
+{% endblock %} diff --git a/web_view.py b/web_view.py index 152d088..50a95e5 100755 --- a/web_view.py +++ b/web_view.py @@ -230,6 +230,11 @@ def redirect_from_root(): def index_page(): return render_template("index.html") +@app.route("/admin/skip_isa") +def admin_skip_isa_list(): + q = model.Item.query.join(model.SkipIsA).order_by(model.Item.item_id) + return render_template("admin/skip_isa.html", q=q) + @app.route("/identifier") def identifier_index():