Add loginrequired
This commit is contained in:
parent
37ae754e7f
commit
066ebd06e6
@ -1,3 +1,4 @@
|
|||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from bootstrap_modal_forms.generic import BSModalCreateView, BSModalLoginView
|
from bootstrap_modal_forms.generic import BSModalCreateView, BSModalLoginView
|
||||||
@ -8,19 +9,22 @@ import os
|
|||||||
import PDMI.settings as settings
|
import PDMI.settings as settings
|
||||||
from .response import response_mimetype, JsonResponse
|
from .response import response_mimetype, JsonResponse
|
||||||
|
|
||||||
|
|
||||||
class SignUpView(BSModalCreateView):
|
class SignUpView(BSModalCreateView):
|
||||||
form_class = CustomUserCreationForm
|
form_class = CustomUserCreationForm
|
||||||
template_name = 'store/signup.html'
|
template_name = 'store/signup.html'
|
||||||
success_message = 'Success: Sign up succeeded. You can now Log in.'
|
success_message = 'Success: Sign up succeeded. You can now Log in.'
|
||||||
success_url = reverse_lazy('store_front_page')
|
success_url = reverse_lazy('store_front_page')
|
||||||
|
|
||||||
|
|
||||||
class CustomLoginView(BSModalLoginView):
|
class CustomLoginView(BSModalLoginView):
|
||||||
authentication_form = CustomAuthenticationForm
|
authentication_form = CustomAuthenticationForm
|
||||||
template_name = 'store/login.html'
|
template_name = 'store/login.html'
|
||||||
success_message = 'Success: You were successfully logged in.'
|
success_message = 'Success: You were successfully logged in.'
|
||||||
extra_content = dict(success_url=reverse_lazy('index'))
|
extra_content = dict(success_url=reverse_lazy('index'))
|
||||||
|
|
||||||
class UploadView(FormView):
|
|
||||||
|
class UploadView(LoginRequiredMixin, FormView):
|
||||||
form_class = FileFieldForm
|
form_class = FileFieldForm
|
||||||
template_name = 'store/upload.html'
|
template_name = 'store/upload.html'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user