aboutsummaryrefslogtreecommitdiff
path: root/apps/journals/views.py
blob: 797db38f3972dacdb9c8c1f142e7d6ef0b6dfe19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.shortcuts import render
from apps.journals.models import Journal
from thatcomputerscientist.utils import i18npatterns


def journal_of_random_thoughts(request):
    META = {
        "title": "Journal: Journal of Random Thoughts",
    }
    request.meta.update(META)
    slug = "journal-of-random-thoughts"
    journal = Journal.objects.get(slug=slug)
    context = {
        "journal": journal,
    }
    return render(request, f"shared/journals/single.html", context)


def single_journal(request, slug):
    try:
        journal = Journal.objects.get(slug=slug)
    except Journal.DoesNotExist:
        journal = None
    META = {
        "title": f"Journal: {journal.name}" if journal else "Journal Not Found",
    }
    request.meta.update(META)
    context = {
        "journal": journal,
    }
    return render(request, f"shared/journals/single.html", context)