Add initial navbar

This includes all boards, as well as report counts if the user is an
admin.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-19 19:45:36 -07:00
parent 2fd9b17b37
commit 60441aa5d9
6 changed files with 60 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
from django.conf import settings as django_settings
from board.models import Board
from board.models import Board, ReportRecord
def settings(request):
@@ -8,3 +8,24 @@ def settings(request):
def boards(request):
return {"boards": Board.objects.filter(readonly=False)}
def reports(request):
user = request.user
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
print("reports!")
if user and user.has_perm("board.view_reportrecord"):
return {
"reports": ReportRecord.objects.all(),
"reports_urgent": ReportRecord.objects.filter(urgent=True),
}
else:
return {}