Skip to content

Commit

Permalink
blog: link to older/newer posts
Browse files Browse the repository at this point in the history
Fix Issue 70 of the amFOSS website
  • Loading branch information
SnehashishReddy committed Apr 2, 2021
1 parent e55f903 commit 5cd124f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions activity/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ def resolve_tags(self):
def resolve_cover(self, info):
return self['cover']

class PaginationObj(graphene.ObjectType):
previous = graphene.String()
next = graphene.String()

def resolve_previous(self, info):
return Blog.objects.values().filter(featured=True,date__lt=self['date']).last()['slug']

def resolve_next(self, info):
return Blog.objects.values().filter(featured=True,date__lt=self['date']).first()['slug']

class BlogObj(graphene.ObjectType):
title = graphene.String(required=True)
Expand All @@ -88,6 +97,7 @@ class BlogObj(graphene.ObjectType):
cover = graphene.String(required=True)
category = graphene.Field(CategoryObj)
collection = graphene.Field(CollectionTagObj)
pagination = graphene.Field(PaginationObj)

def resolve_title(self, info):
return self['title']
Expand Down Expand Up @@ -126,6 +136,9 @@ def resolve_collection(self, info):
return Collection.objects.values().get(id=self['collection_id'])


def resolve_pagination(self,info):
return self

class AchievementObj(graphene.ObjectType):
title = graphene.String(required=True)
user = graphene.Field(UserBasicObj)
Expand Down

0 comments on commit 5cd124f

Please sign in to comment.