Browse Source

redirect default view depending on user login

php2python
Holger Frey 7 years ago
parent
commit
a1291e5774
  1. 15
      ordr2/views/pages.py

15
ordr2/views/pages.py

@ -1,13 +1,24 @@ @@ -1,13 +1,24 @@
from pyramid.response import Response
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
@view_config(
context='ordr2.resources.Root',
permission='view'
)
def welcome(context, request):
next = 'orders' if request.user else 'about'
redirect_to = request.resource_url(context, next)
return HTTPFound(redirect_to)
@view_config(
context='ordr2.resources.Root',
name='about',
permission='view',
renderer='ordr2:templates/pages/welcome.jinja2'
)
def welcome(context, request):
def about(context, request):
return {}