adding command to store blog posts locally
This commit is contained in:
@@ -103,7 +103,7 @@ from rowers.models import (
|
||||
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
|
||||
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
||||
CalcAgePerformance,
|
||||
PowerTimeFitnessMetric,
|
||||
PowerTimeFitnessMetric,BlogPost,
|
||||
PlannedSessionForm,
|
||||
PlannedSessionFormSmall,GeoCourseEditForm,VirtualRace,
|
||||
VirtualRaceForm,VirtualRaceResultForm,RowerImportExportForm,
|
||||
@@ -801,8 +801,23 @@ def get_thumbnails(request,id):
|
||||
|
||||
return JSONResponse(charts)
|
||||
|
||||
|
||||
def get_blog_posts(request):
|
||||
blogposts = BlogPost.objects.all().order_by("-date")
|
||||
|
||||
jsondata = []
|
||||
|
||||
if blogposts:
|
||||
for blogpost in blogposts[0:3]:
|
||||
thedict = {
|
||||
'title':blogpost.title,
|
||||
'link':blogpost.link,
|
||||
}
|
||||
|
||||
jsondata.append(thedict)
|
||||
|
||||
return JSONResponse(jsondata)
|
||||
|
||||
def get_blog_posts_old(request):
|
||||
try:
|
||||
response = requests.get(
|
||||
'https://analytics.rowsandall.com/wp-json/wp/v2/posts?per_page=3')
|
||||
|
||||
Reference in New Issue
Block a user