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
|
||||||
"""
|
"""
|
||||||
if request.user.is_authenticated:
|
extra_context = {'title': _('Welcome to the Mediatek database')}
|
||||||
return redirect('admin:index')
|
template_name = 'admin/index.html'
|
||||||
else:
|
|
||||||
return render(request, 'admin/index.html', {
|
def dispatch(self, request, *args, **kwargs):
|
||||||
'title': _('Welcome to the Mediatek database'),
|
if request.user.is_authenticated:
|
||||||
})
|
return redirect('admin:index')
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class FindMediumView(LoginRequiredMixin, TemplateView):
|
class FindMediumView(LoginRequiredMixin, TemplateView):
|
||||||
|
|
Loading…
Reference in New Issue