diff --git a/project/customer/models.py b/project/customer/models.py index 8038795..d335c07 100644 --- a/project/customer/models.py +++ b/project/customer/models.py @@ -18,6 +18,8 @@ PROFILE_IMAGES_UPLOAD_DIR = 'customer/profile/' # куда сохранять з BOSS_SIGN_IMG_SIZE = (100, 75) GLAVBUH_SIGN_IMG_SIZE = (100, 75) STAMP_IMG_SIZE = (180, 180) +LOGO_SIZE = (100, 50) + def get_profile(user): """Возвращает профиль пользователя или None.""" @@ -122,7 +124,7 @@ class UserProfile(models.Model): filename = str(orig_img.path) img = Image.open(filename).convert("RGB") img.thumbnail(size, Image.ANTIALIAS) - img.save(filename, 'bmp') + img.save(filename, 'BMP') super(UserProfile, self).save(*args, **kwargs) @@ -135,6 +137,9 @@ class UserProfile(models.Model): if self.stamp: process_img(self.stamp, size=STAMP_IMG_SIZE) + if self.logo: + process_img(self.logo, size=LOGO_SIZE) + def is_ip(self): return self.profile_type == consts.IP_PROFILE diff --git a/project/myauth/forms.py b/project/myauth/forms.py index f97ac78..a1428bb 100644 --- a/project/myauth/forms.py +++ b/project/myauth/forms.py @@ -132,6 +132,15 @@ class ChangeEmailForm(forms.Form): raise forms.ValidationError(u'Неверный пароль.') return password + def clean_email(self): + """Проверить не зарегистрирован ли email.""" + email = self.cleaned_data['email'] + try: + User.objects.get(email__iexact = email) + raise forms.ValidationError(u'Такой e-mail уже зарегистрирован.') + except User.DoesNotExist: + return email + class LoginForm(forms.Form): """Форма логина.""" diff --git a/project/templates/base.html b/project/templates/base.html index 09f03a2..5542c41 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -36,7 +36,7 @@ {% if user.is_authenticated %}
- Личный кабинет + {{ request.user.profile.get_company_name|default:'Новый профиль' }}  |  Выход
diff --git a/project/templates/customer/index.html b/project/templates/customer/index.html index 001515c..7e0e597 100644 --- a/project/templates/customer/index.html +++ b/project/templates/customer/index.html @@ -9,6 +9,8 @@ Расчётные счета

Контрагенты

Лицензии

+ Сменить пароль

+ Сменить e-mail

diff --git a/project/templates/docs/invoice/as_pdf.html b/project/templates/docs/invoice/as_pdf.html index 4407521..a04bcad 100644 --- a/project/templates/docs/invoice/as_pdf.html +++ b/project/templates/docs/invoice/as_pdf.html @@ -33,9 +33,18 @@
diff --git a/project/xls_templates/invoice.xls b/project/xls_templates/invoice.xls index aee4c3d..539590b 100644 Binary files a/project/xls_templates/invoice.xls and b/project/xls_templates/invoice.xls differ