|
|
|
|
@ -206,12 +206,12 @@ class RegistrationCompleteForm(forms.ModelForm): |
|
|
|
|
city = forms.CharField(label='Город', widget=forms.HiddenInput()) |
|
|
|
|
url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'url(обязательно)')})) |
|
|
|
|
|
|
|
|
|
code_country = forms.ChoiceField(label=_(u'код страны'), initial='70', |
|
|
|
|
choices=[(str(c.phone_code), '+' + str(c.phone_code)) for c in |
|
|
|
|
Country.objects.all() if c.phone_code is not None], |
|
|
|
|
widget=forms.Select(attrs={'class': 'select2'})) |
|
|
|
|
code_city = forms.CharField(label=_(u'код города')) |
|
|
|
|
phone = forms.CharField(label=_(u'ваш номер')) |
|
|
|
|
# code_country = forms.ChoiceField(label=_(u'код страны'), initial='70', |
|
|
|
|
# choices=[(str(c.phone_code), '+' + str(c.phone_code)) for c in |
|
|
|
|
# Country.objects.all() if c.phone_code is not None], |
|
|
|
|
# widget=forms.Select(attrs={'class': 'select2'})) |
|
|
|
|
# code_city = forms.CharField(label=_(u'код города')) |
|
|
|
|
# phone = forms.CharField(label=_(u'ваш номер')) |
|
|
|
|
|
|
|
|
|
class Meta: |
|
|
|
|
model = User |
|
|
|
|
@ -220,9 +220,9 @@ class RegistrationCompleteForm(forms.ModelForm): |
|
|
|
|
def save(self, force_insert=False, force_update=False, commit=True): |
|
|
|
|
user = super(RegistrationCompleteForm, self).save(commit=False) |
|
|
|
|
data = self.cleaned_data |
|
|
|
|
phone = data['code_country'] + data['code_city'] + data['phone'] |
|
|
|
|
# phone = data['code_country'] + data['code_city'] + data['phone'] |
|
|
|
|
|
|
|
|
|
user.profile.phone = int(phone) |
|
|
|
|
# user.profile.phone = int(phone) |
|
|
|
|
user.profile.country = data['country'] |
|
|
|
|
user.profile.city = data['city'] |
|
|
|
|
user.profile.save() |
|
|
|
|
|