views.py 593 Bytes
Newer Older
1
from django.views.generic import TemplateView
2
from vm.models import Instance
3 4 5


class IndexView(TemplateView):
Kálmán Viktor committed
6
    template_name = "dashboard/index.html"
7

8
    def get_context_data(self, **kwargs):
9 10 11 12 13
        if self.request.user.is_authenticated():
            user = self.request.user
        else:
            user = None

14 15
        context = super(IndexView, self).get_context_data(**kwargs)
        context.update({
16
            'instances': Instance.objects.filter(owner=user),
17 18 19
        })
        return context

20 21

class VmDetailView(TemplateView):
Kálmán Viktor committed
22
    template_name = "dashboard/vm-detail.html"