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:
@ -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'),
|
||||
})
|
||||
|
Reference in New Issue
Block a user