Destroy Django 1.11 functions
This commit is contained in:
parent
b638add396
commit
70018f0043
|
@ -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')
|
||||
else:
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue