ignore/replace to create requires pk, refs #1927

This commit is contained in:
Simon Willison 2022-12-07 17:18:40 -08:00
commit 6b27537988
2 changed files with 32 additions and 0 deletions

View file

@ -605,6 +605,11 @@ class TableCreateView(BaseView):
if not data.get("row") and not data.get("rows"):
return _error(["ignore and replace require row or rows"])
# ignore and replace require pk or pks
if "ignore" in data or "replace" in data:
if not data.get("pk") and not data.get("pks"):
return _error(["ignore and replace require pk or pks"])
ignore = data.get("ignore")
replace = data.get("replace")