2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 23:17:05 +00:00

Started removing foreignkeys to caves, to achieve greater flexability. Some log book entries stuff may be broken. Add ability to make new caves and entrances via website.

This commit is contained in:
expo
2012-08-12 19:10:23 +02:00
parent 5ff163efaa
commit 28047277f1
10 changed files with 79 additions and 21 deletions

View File

@@ -128,7 +128,6 @@ def editflatpage(request, path):
if request.method == 'POST': # If the form has been submitted...
flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data
if flatpageForm.is_valid():# Form valid therefore write file
f = open(filepath, "w")
if filefound:
headmatch = re.match(r"(.*)<title>.*</title>(.*)", head, re.DOTALL + re.IGNORECASE)
if headmatch:
@@ -144,7 +143,9 @@ def editflatpage(request, path):
postbody = "</html>"
body = flatpageForm.cleaned_data["html"]
body = body.replace("\r", "")
f.write("%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody))
result = u"%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
f = open(filepath, "w")
f.write(result)
f.close()
return HttpResponseRedirect(reverse('flatpage', args=[path])) # Redirect after POST
else: