move Activities section into an admin page for easy editing

This commit is contained in:
2022-05-17 18:28:17 +02:00
parent 0e196b2e21
commit fa26947461
12 changed files with 65 additions and 52 deletions

View File

@@ -93,6 +93,24 @@ def blog_edit(request):
def blog_search(request):
criteria = ''
liste = ''
# generate a list of all tags of all topics
if request.authenticated_userid:
# get all topics
topics = BlogRecordService.get_topics(request)
for topic in topics:
liste += '<h4>' + topic.topic_name + '</h4>'
# get all the tags of the topic
tags = BlogRecordService.get_tags_byTopic(request, topic.topic)
if tags:
liste += '<ul>'
for tag in tags:
count = len(BlogRecordService.by_topic(request, tag.topic, tag.tag))
liste += '<button type="button" class="btn">{0} <span class="badge">{1}</span></button>&nbsp;'.format(
tag.tag_name, count)
liste += '</ul>'
form = BlogSearchForm(request.POST)
items = []
if 'form.submitted' in request.params and form.validate():
@@ -105,6 +123,7 @@ def blog_search(request):
'form': form,
'items': items,
'criteria': criteria,
'liste': liste,
}

View File

@@ -30,8 +30,12 @@ def home(request):
dir + '/S21.jpg',
dir + '/S25.jpg']
# get the 5 last modified posts
last_five = BlogRecordService.get_last_five(request)
# get the Activities section
activ = BlogRecordService.get_activities(request)
# insèrer le path de static/img
activities = activ.body.replace('static/img/', "%s/static/img/" % request.application_url)
# get the last created posts
last_five = BlogRecordService.get_last_created(request)
name = ''
email = ''
comments = ''
@@ -71,6 +75,7 @@ Le site "meditation-sunyata.paris"
return {
'page_title': "",
'last_five': last_five,
'activities': activities,
'car_images': car_images,
'name': name,
'email': email,