Admin page for checking skip IsA list
This commit is contained in:
parent
a91790b66d
commit
e25aaa5ec6
|
@ -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')
|
||||
|
|
17
templates/admin/skip_isa.html
Normal file
17
templates/admin/skip_isa.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-2">
|
||||
|
||||
<h1>Skip <em>instance of</em> list</h1>
|
||||
|
||||
<ul>
|
||||
{% for item in q %}
|
||||
<li><a href="{{ item.wd_url }}">{{ item.label() }}</a> ({{ item.qid }})
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue