Update web/core/views.py
This commit is contained in:
parent
efdc18c980
commit
cee86a76d2
@ -328,6 +328,19 @@ def entry_delete(request, entry_id):
|
||||
@login_required
|
||||
@user_passes_test(is_admin)
|
||||
def import_wizard(request):
|
||||
# Safety: use global EXPECTED_HEADERS if present; otherwise fall back locally
|
||||
_EXPECTED_HEADERS = globals().get("EXPECTED_HEADERS", [
|
||||
"Subject",
|
||||
"Illustration",
|
||||
"Application",
|
||||
"Scripture",
|
||||
"Source",
|
||||
"Talk Title",
|
||||
"Talk Number",
|
||||
"Code",
|
||||
"Date",
|
||||
"Date Edited",
|
||||
])
|
||||
if request.method == "POST":
|
||||
form = ImportForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
@ -340,7 +353,7 @@ def import_wizard(request):
|
||||
rdr = _csv.reader(sio)
|
||||
first_row = next(rdr, [])
|
||||
norm = [c.strip().lower() for c in first_row]
|
||||
expected_norm = [c.lower() for c in EXPECTED_HEADERS]
|
||||
expected_norm = [c.lower() for c in _EXPECTED_HEADERS]
|
||||
|
||||
# If the first row doesn’t look like our header, allow import to proceed,
|
||||
# but show a gentle warning in the result page.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user