allow guest login

This commit is contained in:
Seth Ladygo
2019-03-13 21:00:36 -07:00
parent 0db088d8f9
commit 16c004e291
4 changed files with 15 additions and 3 deletions

View File

@ -20,10 +20,11 @@ from dashboard.views import dashboard
from lazysignup.views import convert
from .forms import UserCreationForm
from .views import lazy_convert_done
from .views import login_guest, lazy_convert_done
urlpatterns = [
path('guest', login_guest, name='login_guest'),
path('', dashboard, name='home'),
path('dashboard', dashboard, name='dashboard'),
path('admin/', admin.site.urls),

View File

@ -2,6 +2,16 @@ from django.shortcuts import redirect
from django.contrib import messages
from django.utils.translation import gettext as _
from lazysignup.decorators import allow_lazy_user
from account.decorators import login_required
@allow_lazy_user
def login_guest(request):
"""Create a lazy user if necessary and redirect."""
messages.info(request, _('Welcome, guest!'))
return redirect('home')
def lazy_convert_done(request):
"""Called after converting a lazy user."""