1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-07-09 12:50:24 +02:00

Merge index views

This commit is contained in:
Alexandre Iooss
2019-08-10 08:04:46 +02:00
parent be96a61ff2
commit aca1d2def6
9 changed files with 189 additions and 108 deletions

View File

@ -8,6 +8,7 @@ from django.db import transaction
from django.shortcuts import redirect, render
from django.template.context_processors import csrf
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from reversion import revisions as reversion
from users.models import User
@ -70,13 +71,11 @@ def retour_emprunt(request, empruntid):
def index(request):
"""
Home page with user's borrowed items
Home page which redirect to admin when logged in
"""
if request.user.is_authenticated:
borrowed_items = Emprunt.objects.filter(user=request.user)
return redirect('admin:index')
else:
borrowed_items = []
return render(request, 'media/index.html', {
'borrowed_items': borrowed_items,
})
return render(request, 'admin/index.html', {
'title': _('Welcome to the Mediatek database'),
})