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)
|
router.register(r'groups', users.views.GroupViewSet)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', media.views.index, name='index'),
|
path('', media.views.IndexView, name='index'),
|
||||||
|
|
||||||
# Include project routers
|
# Include project routers
|
||||||
path('users/', include('users.urls')),
|
path('users/', include('users.urls')),
|
||||||
|
|
|
@ -40,16 +40,17 @@ def retour_emprunt(request, empruntid):
|
||||||
return redirect("admin:media_emprunt_changelist")
|
return redirect("admin:media_emprunt_changelist")
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
class IndexView(TemplateView):
|
||||||
"""
|
"""
|
||||||
Home page which redirect to admin when logged in
|
Home page which redirect to admin when logged in
|
||||||
"""
|
"""
|
||||||
|
extra_context = {'title': _('Welcome to the Mediatek database')}
|
||||||
|
template_name = 'admin/index.html'
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
return redirect('admin:index')
|
return redirect('admin:index')
|
||||||
else:
|
return super().dispatch(request, *args, **kwargs)
|
||||||
return render(request, 'admin/index.html', {
|
|
||||||
'title': _('Welcome to the Mediatek database'),
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
class FindMediumView(LoginRequiredMixin, TemplateView):
|
class FindMediumView(LoginRequiredMixin, TemplateView):
|
||||||
|
|
Loading…
Reference in New Issue