Verified Commit 70018f00 authored by ynerant's avatar ynerant
Browse files

Destroy Django 1.11 functions

parent b638add3
Pipeline #9506 passed with stages
in 2 minutes and 18 seconds
......@@ -27,7 +27,7 @@ router.register(r'users', users.views.UserViewSet)
router.register(r'groups', users.views.GroupViewSet)
urlpatterns = [
path('', media.views.index, name='index'),
path('', media.views.IndexView, name='index'),
# Include project routers
path('users/', include('users.urls')),
......@@ -40,16 +40,17 @@ def retour_emprunt(request, empruntid):
return redirect("admin:media_emprunt_changelist")
def index(request):
class IndexView(TemplateView):
Home page which redirect to admin when logged in
if request.user.is_authenticated:
return redirect('admin:index')
return render(request, 'admin/index.html', {
'title': _('Welcome to the Mediatek database'),
extra_context = {'title': _('Welcome to the Mediatek database')}
template_name = 'admin/index.html'
def dispatch(self, request, *args, **kwargs):
if request.user.is_authenticated:
return redirect('admin:index')
return super().dispatch(request, *args, **kwargs)
class FindMediumView(LoginRequiredMixin, TemplateView):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment