diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html
index faacee82..d03713c1 100644
--- a/hosting/templates/hosting/payment.html
+++ b/hosting/templates/hosting/payment.html
@@ -2,139 +2,182 @@
{% load staticfiles bootstrap3 i18n %}
{% block content %}
-
-
-
-
-
-
{%trans "Billing Address"%}
-
-
+
{% if stripe_key %}
{% get_current_language as LANGUAGE_CODE %}
{%endif%}
diff --git a/hosting/views.py b/hosting/views.py
index e0554ebf..520894ae 100644
--- a/hosting/views.py
+++ b/hosting/views.py
@@ -440,6 +440,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
form_kwargs.update({
'initial': {
+ 'cardholder_name': current_billing_address.cardholder_name,
'street_address': current_billing_address.street_address,
'city': current_billing_address.city,
'postal_code': current_billing_address.postal_code,
diff --git a/membership/models.py b/membership/models.py
index 96bf4c50..a84d12ca 100644
--- a/membership/models.py
+++ b/membership/models.py
@@ -51,6 +51,8 @@ class MyUserManager(BaseUserManager):
name=name,
)
user.is_admin = True
+ user.is_active = True
+ user.is_superuser = True
user.save(using=self._db)
return user
diff --git a/utils/forms.py b/utils/forms.py
index 15086dc6..c521e3ba 100644
--- a/utils/forms.py
+++ b/utils/forms.py
@@ -5,11 +5,12 @@ from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import authenticate
from membership.models import CustomUser
+
+
# from utils.fields import CountryField
class SignupFormMixin(forms.ModelForm):
-
confirm_password = forms.CharField(widget=forms.PasswordInput())
password = forms.CharField(widget=forms.PasswordInput())
@@ -50,8 +51,6 @@ class LoginFormMixin(forms.Form):
return email
except CustomUser.DoesNotExist:
raise forms.ValidationError("User does not exist")
- else:
- return email
class PasswordResetRequestForm(forms.Form):
@@ -67,8 +66,6 @@ class PasswordResetRequestForm(forms.Form):
return email
except CustomUser.DoesNotExist:
raise forms.ValidationError("User does not exist")
- else:
- return email
class SetPasswordForm(forms.Form):
@@ -91,7 +88,7 @@ class SetPasswordForm(forms.Form):
if password1 != password2:
raise forms.ValidationError(
self.error_messages['password_mismatch'],
- code='password_mismatch',)
+ code='password_mismatch', )
return password2
@@ -104,8 +101,9 @@ class BillingAddressForm(forms.ModelForm):
class Meta:
model = BillingAddress
- fields = ['street_address', 'city', 'postal_code', 'country']
+ fields = ['cardholder_name', 'street_address', 'city', 'postal_code', 'country']
labels = {
+ 'cardholder_name': _('Cardholder Name'),
'street_address': _('Street Address'),
'city': _('City'),
'postal_code': _('Postal Code'),
diff --git a/utils/models.py b/utils/models.py
index 2aee584b..c969a60c 100644
--- a/utils/models.py
+++ b/utils/models.py
@@ -8,6 +8,7 @@ from .fields import CountryField
# Create your models here.
class BaseBillingAddress(models.Model):
+ cardholder_name = models.CharField(max_length=100, default="")
street_address = models.CharField(max_length=100)
city = models.CharField(max_length=50)
postal_code = models.CharField(max_length=50)
@@ -18,7 +19,6 @@ class BaseBillingAddress(models.Model):
class BillingAddress(BaseBillingAddress):
-
def __str__(self):
return self.street_address
@@ -32,6 +32,7 @@ class UserBillingAddress(BaseBillingAddress):
def to_dict(self):
return {
+ 'Cardholder Name': self.cardholder_name,
'Street Address': self.street_address,
'City': self.city,
'Postal Code': self.postal_code,