doc: add a notice on pages living on redmine

This commit is contained in:
Frédéric Péters 2019-03-06 16:22:05 +01:00
parent 456ce91aef
commit 2da1526175
1 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import html5lib
import requests
@ -20,4 +22,16 @@ for cell in TextCell.objects.filter(slug__in=DOCS.keys(), page__snapshot__isnull
content = document.find('body')
new_content = unicode(content).replace('<body>', '').replace('</body>', '')
cell.text = new_content
cell.order = 1
cell.save()
url = DOCS[cell.slug].replace('.html', '').decode('utf-8')
cell, created = TextCell.objects.get_or_create(
page=cell.page,
slug='editor-warning', defaults={'order': 0})
cell.placeholder = 'content'
cell.order = 0
cell.text = u'''<div class="note note-tip"><div>Cette page est tirée de redmine, l'édition se fait là :<br>
<a href="%s">%s</a>.</div></div>''' % (url, url)
cell.public = False
cell.save()