diff options
| author | Bobby <[email protected]> | 2022-11-14 06:53:18 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-11-14 06:53:18 -0500 |
| commit | 324d3acfdf3cc024b2cc1edc721085448d36ccda (patch) | |
| tree | 24c9a161f3807609de2c6716e84c37ecb0fc0a6a /blog | |
| parent | 85531d778d82da8dc9992e499bee7111958a554b (diff) | |
| download | thatcomputerscientist-324d3acfdf3cc024b2cc1edc721085448d36ccda.tar.xz thatcomputerscientist-324d3acfdf3cc024b2cc1edc721085448d36ccda.zip | |
adding context processors and removing unneeded js
Diffstat (limited to 'blog')
| -rw-r--r-- | blog/context_processors.py | 8 | ||||
| -rw-r--r-- | blog/views.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/blog/context_processors.py b/blog/context_processors.py index de9371ae..4df11416 100644 --- a/blog/context_processors.py +++ b/blog/context_processors.py @@ -6,10 +6,10 @@ def recent_posts(): post.excerpt = post.body.split('>')[1].split('<')[0] return recent_posts -def categories(): +def categories(request): categories = Category.objects.all() - return categories + return {'categories': categories} -def archives(): +def archives(request): archives = Post.objects.filter(is_public=True).dates('date', 'month', order='DESC') - return archives + return {'archives': archives} diff --git a/blog/views.py b/blog/views.py index 9fa95801..b514750a 100644 --- a/blog/views.py +++ b/blog/views.py @@ -18,7 +18,7 @@ from announcements.models import Announcement def home(request): announcements = Announcement.objects.filter(is_public=True).order_by('-created_at') announcements = announcements if len(announcements) > 0 else None - return render(request, 'blog/home.html', {'title': 'Home', 'recent_posts': recent_posts(), 'categories': categories(), 'archives': archives(), 'announcements': announcements}) + return render(request, 'blog/home.html', {'title': 'Home', 'recent_posts': recent_posts(), 'announcements': announcements}) def account(request): user = request.user |
