logo, links etc

remotes/origin/yandex
Bachurin Sergey 12 years ago
parent abbe2ecc82
commit 1acd5a98d9
  1. 7
      project/customer/models.py
  2. 9
      project/myauth/forms.py
  3. 2
      project/templates/base.html
  4. 2
      project/templates/customer/index.html
  5. 15
      project/templates/docs/invoice/as_pdf.html
  6. BIN
      project/xls_templates/invoice.xls

@ -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

@ -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):
"""Форма логина."""

@ -36,7 +36,7 @@
{% if user.is_authenticated %}
<div style="float: right; margin-right: 10px;">
<a href="{% url 'customer_index' %}" style="margin-right: 10px">Личный кабинет</a>
<a href="{% url 'customer_index' %}" style="margin-right: 10px">{{ request.user.profile.get_company_name|default:'Новый профиль' }}</a>
&nbsp;|&nbsp;
<a href="{% url 'auth_logout' %}">Выход</a>
</div>

@ -9,6 +9,8 @@
<a href="{% url 'customer_bank_accounts_list' %}">Расчётные счета</a><br /><br />
<a href="{% url 'customer_clients_list' %}">Контрагенты</a><br /><br />
<a href="{% url 'customer_license_list' %}">Лицензии</a><br /><br />
<a href="{% url 'myauth_change_password' %}">Сменить пароль</a><br /><br />
<a href="{% url 'myauth_change_email' %}">Сменить e-mail</a><br /><br />
</div>
<div style="float:left; margin-left: 40px; border-left: 1px solid; padding-left: 20px;">

@ -33,9 +33,18 @@
<body>
<div id="header">
{{ profile.get_company_name }}<br />
{{ profile.address }}
{% if profile.phone %} , тел. {{ profile.get_full_phone }}{% endif %}<br />
<table width="100%">
<tr class="">
<td width="20%">
{% if profile.logo %}<img src="{{ profile.logo.path }}" />{% endif %}
</td>
<td width="80%">
{{ profile.get_company_name }}<br />
{{ profile.address }}
{% if profile.phone %} , тел. {{ profile.get_full_phone }}{% endif %}<br />
</td>
</tr>
</table>
</div>
<div id="content_header">

Binary file not shown.
Loading…
Cancel
Save