devicehub-django/snapshot/views.py

41 lines
1.2 KiB
Python
Raw Normal View History

2024-07-11 15:40:45 +00:00
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
2024-07-13 13:27:26 +00:00
from django.views.generic.edit import FormView
from django.urls import reverse_lazy
2024-07-11 15:40:45 +00:00
from dashboard.mixins import DashboardView
from snapshot.models import Snapshot
2024-07-15 14:23:14 +00:00
# from snapshot.forms import UploadForm
2024-06-12 07:32:49 +00:00
# from django.shortcuts import render
2024-07-01 10:17:23 +00:00
# from rest_framework import viewsets
# from snapshot.serializers import SnapshotSerializer
2024-06-12 07:32:49 +00:00
2024-07-01 10:17:23 +00:00
# class SnapshotViewSet(viewsets.ModelViewSet):
# queryset = Snapshot.objects.all()
# serializer_class = SnapshotSerializer
2024-06-12 07:32:49 +00:00
2024-07-11 15:40:45 +00:00
class ListSnapshotsView(DashboardView, TemplateView):
template_name = "snapshots.html"
section = "snapshots"
title = _("Snapshots")
breadcrumb = "Snapshots"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
snapshots = Snapshot.objects.filter(owner=self.request.user)
context.update({
'snapshots': snapshots,
})
return context
2024-07-13 13:27:26 +00:00
2024-07-15 14:23:14 +00:00
# class UploadView(DashboardView, FormView):
# template_name = "upload.html"
# section = "snapshots"
# title = _("Upload Snapshot")
# breadcrumb = "Snapshots / Upload"
# success_url = reverse_lazy('snashot:list')
# form_class = UploadForm