Пример #1
0
 def setUp(self):
     super(TestDefaultStorageFinder, self).setUp()
     self.finder = finders.DefaultStorageFinder(
         storage=storage.StaticFilesStorage(location=settings.MEDIA_ROOT))
     test_file_path = os.path.join(settings.MEDIA_ROOT, 'media-file.txt')
     self.find_first = ('media-file.txt', test_file_path)
     self.find_all = ('media-file.txt', [test_file_path])
Пример #2
0
 def __init__(self, *args, manifest_storage=None, **kwargs):
     manifest_storage = storage.StaticFilesStorage(
         location=kwargs.pop('manifest_location'), )
     super().__init__(*args, manifest_storage=manifest_storage, **kwargs)
Пример #3
0
"""Módulo contém views genéricas ou globais ao projeto."""

import django_weasyprint
from django.contrib.auth import mixins
from django.contrib.staticfiles import storage
from django.views import generic

from ponto.models import DiaTrabalho

static_storage = storage.StaticFilesStorage()


class DashboardView(mixins.LoginRequiredMixin, generic.TemplateView):
    """Index."""

    template_name = 'dashboard.html'


dashboard = DashboardView.as_view()


class Relatório(django_weasyprint.WeasyTemplateView):
    """Relatório teste."""

    template_name = 'core/relatórios/a4.html'
    pdf_stylesheets = [
        static_storage.path('bootstrap/dist/css/bootstrap.min.css'),
        static_storage.path('css/relatórios/base.css'),
    ]

    def get_context_data(self, **kwargs):