コード例 #1
0
ファイル: views.py プロジェクト: JoKeyser/Plinth
    def get_context_data(self, *args, **kwargs):
        """Return template context data."""
        context = super().get_context_data(*args, **kwargs)

        disks = storage.get_disks()
        root_device = storage.get_root_device(disks)
        expandable_root_size = storage.is_expandable(root_device)
        expandable_root_size = storage.format_bytes(expandable_root_size)

        context['disks'] = disks
        context['expandable_root_size'] = expandable_root_size
        return context
コード例 #2
0
ファイル: views.py プロジェクト: SunilMohanAdapa/Plinth
def index(request):
    """Show connection list."""
    disks = storage.get_disks()
    root_device = storage.get_root_device(disks)
    expandable_root_size = storage.is_expandable(root_device)
    expandable_root_size = storage.format_bytes(expandable_root_size)

    warn_about_low_disk_space(request)

    return TemplateResponse(request, 'storage.html',
                            {'title': _('Storage'),
                             'disks': disks,
                             'expandable_root_size': expandable_root_size})
コード例 #3
0
def index(request):
    """Show connection list."""
    disks = storage_module.get_disks()
    root_device = storage_module.get_root_device(disks)
    expandable_root_size = storage_module.is_expandable(root_device)
    expandable_root_size = _format_bytes(expandable_root_size)

    warn_about_low_disk_space(request)

    return TemplateResponse(request, 'storage.html',
                            {'title': _('Storage'),
                             'disks': disks,
                             'expandable_root_size': expandable_root_size})
コード例 #4
0
ファイル: views.py プロジェクト: SunilMohanAdapa/Plinth
def expand(request):
    """Warn and expand the root partition."""
    disks = storage.get_disks()
    root_device = storage.get_root_device(disks)

    if request.method == 'POST':
        expand_partition(request, root_device)
        return redirect(reverse('storage:index'))

    expandable_root_size = storage.is_expandable(root_device)
    expandable_root_size = storage.format_bytes(expandable_root_size)
    return TemplateResponse(request, 'storage_expand.html',
                            {'title': _('Expand Root Partition'),
                             'expandable_root_size': expandable_root_size})
コード例 #5
0
def expand(request):
    """Warn and expand the root partition."""
    disks = storage_module.get_disks()
    root_device = storage_module.get_root_device(disks)

    if request.method == 'POST':
        expand_partition(request, root_device)
        return redirect(reverse('storage:index'))

    expandable_root_size = storage_module.is_expandable(root_device)
    expandable_root_size = _format_bytes(expandable_root_size)
    return TemplateResponse(request, 'storage_expand.html',
                            {'title': _('Expand Root Partition'),
                             'expandable_root_size': expandable_root_size})