Skip to content

Commit

Permalink
bug fixed.
Browse files Browse the repository at this point in the history
- getter added for category.
  • Loading branch information
nimaafshar79 committed May 27, 2020
1 parent 3a995f0 commit 96ae36c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions foods/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def recipe(self):
return None
else:
payload = json.loads(self.Recipe)
payload['category'] = self.Category
payload['category'] = self.get_category()
payload['date_created'] = self.CreatedAt.strftime('%Y-%m-%d %H:%M:%S')
return payload

Expand All @@ -55,7 +55,7 @@ def simple_view(self):
"""
return {
'id': self.id,
'category': self.Category,
'category': self.get_category(),
'image': self.Image,
'thumbnail': self.Thumbnail,
'title': self.Title,
Expand All @@ -71,6 +71,9 @@ def __str__(self):
def get_calorie(self):
return self.Calories

def get_category(self):
return self.Category.strip().lower()


# for admin integration
class FoodModelView(ModelView):
Expand Down

0 comments on commit 96ae36c

Please sign in to comment.