check d object must be dict to get url or id
This commit is contained in:
parent
19383ab9f3
commit
f22e2c884c
1 changed files with 6 additions and 3 deletions
3
app.py
3
app.py
|
@ -285,9 +285,12 @@ def domain(url):
|
|||
|
||||
@app.template_filter()
|
||||
def url_or_id(d):
|
||||
if isinstance(d, dict):
|
||||
if ("url" in d) and isinstance(d["url"], str):
|
||||
return d["url"]
|
||||
else:
|
||||
return d["id"]
|
||||
return ""
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue