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