Display basic borg repo information

This commit is contained in:
George Lacey 2021-05-06 14:18:48 +01:00
parent 196a49f18b
commit bd31338b9e
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
{% if repo_list %}
{% for repo in repo_list %}
<div>
<header>{{ repo.label }} ({{ repo.location }}) </header>
<ul>
<li>Latest backup: {{ repo.last_backup }}</li>
<li>Un/Compressed size: {{ repo.size }}</li>
<li>{{ repo.recent_errors }}</li>
</ul>
</div>
{% endfor %}
{% else %}
<p>No repos found.</p>
{% endif %}
</head>
<body>
</body>
</html>

View File

@ -1,6 +1,18 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render
from .models import Repo, Label
def index(request):
return HttpResponse("Index here")
repo_list = Repo.objects.all()
label_list = Label.objects.all()
# template = loader.get_template('borg/index.html')
context = {
'repo_list': repo_list,
'label_list': label_list,
}
# return HttpResponse(template.render(context, request))
return render(request, 'borg/index.html', context)