Example #1
0
def edit(request, url):

	# find all files for menu
	files = Files.objects.all()

	# get content
	document = Files()
	try:
		document = Files.objects.get(url=url)
		document.status = "ok"
	except:
		document.status = "none"

	context = {
		"files": files,
		"document": document,
	}
	return render(request, 'edit.html', context)
Example #2
0
def index(request, url):

	# find all files for menu
	files = Files.objects.all().values("name", "url")

	# set default url README
	if url == "":
		url = DEF_URL

	# get content
	document = Files()
	try:
		document = Files.objects.get(url=url)
		html_data = markdown2.markdown(document.data)
		document.data = html_data
		document.status = "ok"
	except:
		document.status = "none"

	context = {
		"files": files,
		"document": document,
	}
	return render(request, 'index.html', context)
Example #3
0
def add(request):

	# find all files for menu
	files = Files.objects.all()

	# empty document without url
	document = Files()
	document.status = "ok"
	document.url = "none"

	context = {
		"files": files,
		"document": document,
	}
	return render(request, 'edit.html', context)