Update red highlight check
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-02 00:17:59 +03:00
parent ae54161c60
commit 71bb9694bc

View File

@ -51,14 +51,12 @@ from oidc import page_oidc, login_required, read_user
from api import page_api from api import page_api
def check_foreign_key_format(item): def check_foreign_key_format(item):
try: owner = item.get("inventory", {}).get("owner", {})
if type(item["inventory"]["owner"]["foreign_id"]) == ObjectId: user = item.get("inventory", {}).get("user", {})
return True if owner.get("foreign_id", False):
if type(item["inventory"]["user"]["foreign_id"]) == ObjectId: return not bool(owner.get("username"))
return True if user.get("foreign_id", False):
except: return not bool(user.get("username"))
pass
return False
def render_markdown(text): def render_markdown(text):
if not text: if not text: