added topic_edit.jinja2
This commit is contained in:
@@ -32,8 +32,7 @@ def blog(request):
|
||||
|
||||
|
||||
@view_config(route_name='blog_edit',
|
||||
renderer='cao_blogr:templates/blog_edit.jinja2',
|
||||
permission='view')
|
||||
renderer='cao_blogr:templates/blog_edit.jinja2', permission='view')
|
||||
def blog_edit(request):
|
||||
# get post parameters from request
|
||||
topic = request.matchdict['topic']
|
||||
@@ -49,6 +48,7 @@ def blog_edit(request):
|
||||
entry.topic_id = topic
|
||||
form = BlogCreateForm(request.POST, entry)
|
||||
form.tag.choices = [(row.tag, row.tag_name) for row in tags]
|
||||
page_title = 'Nouvelle page'
|
||||
|
||||
else:
|
||||
# modify post
|
||||
@@ -58,6 +58,7 @@ def blog_edit(request):
|
||||
return HTTPFound(location=request.route_url('home'))
|
||||
form = BlogUpdateForm(request.POST, entry)
|
||||
form.tag.choices = [(row.tag, row.tag_name) for row in tags]
|
||||
page_title = 'Modifier : ' + entry.title
|
||||
|
||||
if 'form.submitted' in request.params and form.validate():
|
||||
if blog_id == '0':
|
||||
@@ -79,7 +80,7 @@ def blog_edit(request):
|
||||
return HTTPFound(location=request.route_url('topic', topic=topic))
|
||||
|
||||
return {
|
||||
'page_title': entry.title,
|
||||
'page_title': page_title,
|
||||
'url': url,
|
||||
'form': form,
|
||||
'blog_id': blog_id,
|
||||
@@ -112,8 +113,12 @@ def blog_search(request):
|
||||
def topic(request):
|
||||
topic = request.matchdict['topic']
|
||||
|
||||
# get the topic_name
|
||||
topic_name = BlogRecordService.get_topic_name(request, topic)
|
||||
# get the topic record
|
||||
topic_record = BlogRecordService.get_topic_byTopic(request, topic)
|
||||
# convertir mardown en HTML
|
||||
markdowner = Markdown()
|
||||
topic_quote = markdowner.convert(topic_record.topic_quote)
|
||||
|
||||
# get all the tags of this topic
|
||||
tags = BlogRecordService.get_tags_byTopic(request, topic)
|
||||
|
||||
@@ -133,7 +138,8 @@ def topic(request):
|
||||
else:
|
||||
liste += '<ul><li> </li></ul>'
|
||||
return {
|
||||
'page_title': topic_name,
|
||||
'page_title': topic_record.topic_name,
|
||||
'topic': topic,
|
||||
'topic_quote': topic_quote,
|
||||
'liste': liste,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user