guild-journal/guild/views/__init__.py

18 lines
627 B
Python

from django.views.generic import TemplateView, ListView, DetailView
from django.views.generic.edit import CreateView
from django.contrib.auth.mixins import LoginRequiredMixin
from guild.models import Adventure, Character, Player
# Create your views here.
class HomeView(LoginRequiredMixin, TemplateView):
template_name = "guild/home.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["adventures"] = Adventure.objects.all()
context["players"] = Player.objects.all()
context["characters"] = Character.objects.all()
return context