Use user.is_authenticated bool field instead of method call
This commit is contained in:
parent
0a3d2a5b3a
commit
d3abf02912
4 changed files with 7 additions and 7 deletions
|
@ -240,7 +240,7 @@ class PaymentOrderView(FormView):
|
||||||
template_name = 'datacenterlight/landing_payment.html'
|
template_name = 'datacenterlight/landing_payment.html'
|
||||||
|
|
||||||
def get_form_class(self):
|
def get_form_class(self):
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
return BillingAddressForm
|
return BillingAddressForm
|
||||||
else:
|
else:
|
||||||
return BillingAddressFormSignup
|
return BillingAddressFormSignup
|
||||||
|
@ -252,7 +252,7 @@ class PaymentOrderView(FormView):
|
||||||
else:
|
else:
|
||||||
billing_address_data = {}
|
billing_address_data = {}
|
||||||
|
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
if billing_address_data:
|
if billing_address_data:
|
||||||
billing_address_form = BillingAddressForm(
|
billing_address_form = BillingAddressForm(
|
||||||
initial=billing_address_data
|
initial=billing_address_data
|
||||||
|
|
|
@ -218,7 +218,7 @@ class UserHostingKeyForm(forms.ModelForm):
|
||||||
return self.data.get('name')
|
return self.data.get('name')
|
||||||
|
|
||||||
def clean_user(self):
|
def clean_user(self):
|
||||||
return self.request.user if self.request.user.is_authenticated() else None
|
return self.request.user if self.request.user.is_authenticated else None
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = self.cleaned_data
|
cleaned_data = self.cleaned_data
|
||||||
|
|
|
@ -284,7 +284,7 @@ class SignupView(HostingContextMixin, CreateView):
|
||||||
|
|
||||||
@method_decorator(decorators)
|
@method_decorator(decorators)
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
return super(SignupView, self).get(request, *args, **kwargs)
|
return super(SignupView, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ class SignupValidatedView(SignupValidateView, HostingContextMixin):
|
||||||
|
|
||||||
@method_decorator(decorators)
|
@method_decorator(decorators)
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
return HttpResponseRedirect(reverse_lazy('hosting:dashboard'))
|
return HttpResponseRedirect(reverse_lazy('hosting:dashboard'))
|
||||||
return super(SignupValidatedView, self).get(request, *args, **kwargs)
|
return super(SignupValidatedView, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class LoginViewMixin(FormView):
|
||||||
|
|
||||||
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
|
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
|
|
||||||
return super(LoginViewMixin, self).get(request, *args, **kwargs)
|
return super(LoginViewMixin, self).get(request, *args, **kwargs)
|
||||||
|
@ -225,7 +225,7 @@ class SSHKeyCreateView(FormView):
|
||||||
'form': UserHostingKeyForm(request=self.request),
|
'form': UserHostingKeyForm(request=self.request),
|
||||||
})
|
})
|
||||||
|
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated:
|
||||||
owner = self.request.user
|
owner = self.request.user
|
||||||
manager = OpenNebulaManager(
|
manager = OpenNebulaManager(
|
||||||
email=owner.username,
|
email=owner.username,
|
||||||
|
|
Loading…
Reference in a new issue