diff --git a/clients/views.py b/clients/views.py index 5fe4aa5..7497b54 100644 --- a/clients/views.py +++ b/clients/views.py @@ -14,7 +14,7 @@ class ClientRegistrationView(InConstructionMixin, LoginRequiredMixin, CreateView model = ClientProfile exclude = ["user"] template_name = "clients/signup.html" - fields = ["company", "vat_id", "first_name", "last_name", "street", "city", "zip", "state", "country"] + fields = ["company", "vat_id", "first_name", "last_name", "street", "city", "zip", "state", "country", "phone"] def dispatch(self, request, *args, **kwargs): try: @@ -43,11 +43,15 @@ class ClientRegistrationView(InConstructionMixin, LoginRequiredMixin, CreateView "city": partner.city, "zip": partner.zip, "state": partner.state, - "country": partner.country + "country": partner.country, + "phone": partner.phone, } except: - return {} + return { + "country": "AT", + "phone": "+43" + } class ClientProfileView(InConstructionMixin, LoginRequiredMixin, UpdateView): model = ClientProfile diff --git a/localauth/models.py b/localauth/models.py index 186d9bc..a3cb75f 100644 --- a/localauth/models.py +++ b/localauth/models.py @@ -22,7 +22,6 @@ class UserManager(BaseUserManager): email = self.normalize_email(email) user = self.model( email=email, - display_name=display_name, **extra_fields ) user.set_password(password) @@ -64,11 +63,11 @@ class User(AbstractBaseUser): has_perm = has_permission class AddressMixin(models.Model): - street = models.CharField(max_length=64) - city = models.CharField(max_length=64) - zip = models.CharField(max_length=16) - state = models.CharField(max_length=64, null=True, blank=True) - country = CountryField() + street = models.CharField("Straße", max_length=64) + city = models.CharField("Stadt", max_length=64) + zip = models.CharField("PLZ", max_length=16) + state = models.CharField("Bundesland", max_length=64, null=True, blank=True) + country = CountryField("Staat") @property def full_address(self): @@ -96,17 +95,17 @@ class ImageMixin(models.Model): abstract = True class PhoneMixin(models.Model): - phone = PhoneNumberField() + phone = PhoneNumberField("Mobiltelefon") class Meta: abstract = True class Profile(AddressMixin, PhoneMixin): user = models.OneToOneField(User, models.CASCADE) - company = models.CharField(max_length=64, null=True, blank=True) - vat_id = models.CharField(max_length=32, null=True, blank=True) - first_name = models.CharField(max_length=64) - last_name = models.CharField(max_length=64) + company = models.CharField("Firma", max_length=64, null=True, blank=True) + vat_id = models.CharField("UID-Nummer", max_length=32, null=True, blank=True) + first_name = models.CharField("Vorname", max_length=64) + last_name = models.CharField("Nachname", max_length=64) verified = models.BooleanField(default=False) enabled = models.BooleanField(default=True) diff --git a/localauth/views.py b/localauth/views.py index 9ce5c1f..ccce646 100644 --- a/localauth/views.py +++ b/localauth/views.py @@ -26,6 +26,8 @@ class RegistrationView(Login): def form_valid(self, form): user = User.objects.create_user(form.cleaned_data["email"]) user.set_password(form.cleaned_data["password1"]) + user.save() + login(self.request, user) messages.success(self.request, "Erfolgreich registriert!") diff --git a/partners/views.py b/partners/views.py index 886abc9..393a3ff 100644 --- a/partners/views.py +++ b/partners/views.py @@ -16,7 +16,7 @@ class PartnerRegistrationView(InConstructionMixin, LoginRequiredMixin, CreateVie model = PartnerProfile exclude = ["user"] template_name = "partners/signup.html" - fields = ["company", "vat_id", "first_name", "last_name", "street", "city", "zip", "state", "country"] + fields = ["company", "vat_id", "first_name", "last_name", "street", "city", "zip", "state", "country", "phone"] def dispatch(self, request, *args, **kwargs): try: @@ -46,11 +46,15 @@ class PartnerRegistrationView(InConstructionMixin, LoginRequiredMixin, CreateVie "city": client.city, "zip": client.zip, "state": client.state, - "country": client.country + "country": client.country, + "phone": client.phone } except: - return {} + return { + "country": "AT", + "phone": "+43" + } class PartnerProfileView(InConstructionMixin, PartnerProfileRequiredMixin, UpdateView): model = PartnerProfile diff --git a/templates/frontend/base.html b/templates/frontend/base.html index b0eb2bc..ab8b19b 100644 --- a/templates/frontend/base.html +++ b/templates/frontend/base.html @@ -145,6 +145,7 @@ + {% if request.user.is_superuser or not request.user.partnerprofile %} + {% endif %} {% if request.user.partnerprofile %}