Merge branch 'release/v10.37'
This commit is contained in:
@@ -805,7 +805,7 @@ def get_thumbnails(request,id):
|
||||
def get_blog_posts(request):
|
||||
try:
|
||||
response = requests.get(
|
||||
'https://analytics.rowsandall.com/wp-json/wp/v2/posts')
|
||||
'https://analytics.rowsandall.com/wp-json/wp/v2/posts?per_page=3')
|
||||
if response.status_code == 200:
|
||||
blogs_json = response.json()
|
||||
# with open('blogs.txt','w') as o:
|
||||
@@ -819,54 +819,21 @@ def get_blog_posts(request):
|
||||
|
||||
|
||||
for postdata in blogs_json[0:3]:
|
||||
|
||||
try:
|
||||
featuredmedia = postdata['featured_media']
|
||||
url = 'https://analytics.rowsandall.com/wp-json/wp/v2/media/%d' % featuredmedia
|
||||
response = requests.get(url)
|
||||
|
||||
if response.status_code == 200:
|
||||
image_json = response.json()
|
||||
image_url = image_json[
|
||||
'media_details'
|
||||
][
|
||||
'sizes'
|
||||
][
|
||||
'thumbnail'
|
||||
][
|
||||
'source_url'
|
||||
]
|
||||
else:
|
||||
image_url = ''
|
||||
except KeyError:
|
||||
image_url = ''
|
||||
|
||||
|
||||
|
||||
try:
|
||||
title = postdata['title']['rendered'].encode(
|
||||
'ascii','xmlcharrefreplace')
|
||||
|
||||
excerpt = postdata['excerpt']['rendered'].encode(
|
||||
'ascii','xmlcharrefreplace')
|
||||
|
||||
ptester = re.compile('\<p\>(\w.*)\<\/p\>')
|
||||
excerpt_first = ptester.match(excerpt).group(1)
|
||||
except TypeError:
|
||||
title = postdata['title']['rendered'].encode(
|
||||
'ascii','xmlcharrefreplace').decode('utf-8')
|
||||
|
||||
excerpt = postdata['excerpt']['rendered'].encode(
|
||||
'ascii','xmlcharrefreplace').decode('utf-8')
|
||||
|
||||
|
||||
ptester = re.compile('\<p\>(\w.*)\<\/p\>')
|
||||
excerpt_first = ptester.match(excerpt).group(1)
|
||||
|
||||
thedict = {
|
||||
'title': title,
|
||||
'author': '',
|
||||
'image': image_url,
|
||||
'excerpt': excerpt_first,
|
||||
# 'author': '',
|
||||
# 'image': image_url,
|
||||
# 'excerpt': excerpt_first,
|
||||
'link': postdata['link'],
|
||||
}
|
||||
|
||||
|
||||
1
static/css/leaflet.min.css
vendored
Normal file
1
static/css/leaflet.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/css/rowsandall2.min.css
vendored
Normal file
1
static/css/rowsandall2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/css/styles2.min.css
vendored
Normal file
1
static/css/styles2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -43,9 +43,9 @@
|
||||
<link rel="stylesheet" href="/static/css/resetnew.css" />
|
||||
<link rel="stylesheet" href="/static/fontawesome/css/fontawesome.min.css">
|
||||
<link rel="stylesheet" href="/static/fontawesome/css/all.min.css">
|
||||
<link rel="stylesheet" href="/static/css/styles2.css">
|
||||
<link rel="stylesheet" href="/static/css/styles2.min.css">
|
||||
<link rel="stylesheet" href="/static/css/text2.css" />
|
||||
<link rel="stylesheet" href="/static/css/rowsandall2.css" />
|
||||
<link rel="stylesheet" href="/static/css/rowsandall2.min.css" />
|
||||
{% block meta %} {% endblock %}
|
||||
<div id="fb-root"></div>
|
||||
<script>(function(d, s, id) {
|
||||
|
||||
Reference in New Issue
Block a user