Allow HTML to be blank and determine the new files need git commiting.

This commit is contained in:
Martin Green 2022-07-26 17:09:15 +01:00
parent 7090bab632
commit 91568b7151

View File

@ -356,7 +356,7 @@ def editexpopage(request, path):
body = body.replace("\r", "")
result = "%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
if result != html: # Check if content changed at all
if not filefound or result != html: # Check if content changed at all
try:
change_message = pageform.cleaned_data["change_message"]
write_and_commit([(filepath, result, "utf-8")], f'{change_message} - online edit of {path}')
@ -382,6 +382,5 @@ class ExpoPageForm(forms.Form):
'''
title = forms.CharField(widget=forms.TextInput(attrs={'size':'60', 'placeholder': "Enter title (displayed in tab)"}))
html = forms.CharField(widget=HTMLarea(attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"},
preview = True
))
preview = True), required=False)
change_message = forms.CharField(widget=forms.Textarea(attrs={"cols":80, "rows":3, 'placeholder': "Describe the change made (for version control records)"}))