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
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})
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})
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})
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})