Remove exams column from QuestionTable and add current user as author during question import

This commit is contained in:
Ross
2025-10-20 12:21:02 +01:00
parent 4ad101d65e
commit 52886d176b
2 changed files with 13 additions and 3 deletions
+10
View File
@@ -741,6 +741,11 @@ def import_llm_questions(request):
elif srcs:
q.sources = [str(srcs)]
q.save()
# Add current user as author of the imported question
try:
q.author.add(request.user)
except Exception:
logger.exception("Failed to add author for imported question idx=%s", idx)
# For each M2M, create missing items if allowed and attach resolved
for key, model_cls in (
@@ -906,6 +911,11 @@ def import_llm_confirm(request):
elif srcs:
q.sources = [str(srcs)]
q.save()
# Add current user as author of the imported question
try:
q.author.add(request.user)
except Exception:
logger.exception("Failed to add author for confirmed import idx=%s", idx)
for key, model_cls in (("finding", Finding), ("structure", Structure), ("condition", Condition), ("presentation", Presentation), ("subspecialty", Subspecialty)):
vals = payload.get(key) or []