add decorator for check active profile for edit docs, some fixes in save profile model with checking existing file img

prod
Dmitriy Shesterkin 8 years ago
parent a926b029c3
commit 5dd9c5b9b9
  1. 22
      Makefile
  2. 8
      src/customer/models.py
  3. 2
      src/customer/utils.py
  4. 1
      src/docs/views/base_views.py
  5. 1
      templates/docs/parts/doc_actions2nd.html

@ -1,4 +1,24 @@
.PHONY: all help build virtualenv requirements-local loaddata run migrate shell collectstatic clean worker qa flush update-develop upgrade-develop update-develop upgrade-develop update-stage upgrade-stage
.PHONY:
all
help
build
virtualenv
requirements-local
loaddata
run
migrate
shell
collectstatic
clean
worker
qa
flush
update-develop
upgrade-develop
update-develop
upgrade-develop
update-stage
upgrade-stage
# target: all - Default target. Does nothing.
all:

@ -222,16 +222,16 @@ class UserProfile(models.Model):
super(UserProfile, self).save(*args, **kwargs)
if self.boss_sign:
if self.boss_sign and os.path.exists(self.boss_sign.path):
process_img(self.boss_sign, size=BOSS_SIGN_IMG_SIZE)
if self.glavbuh_sign:
if self.glavbuh_sign and os.path.exists(self.glavbuh_sign.path):
process_img(self.glavbuh_sign, size=GLAVBUH_SIGN_IMG_SIZE)
if self.stamp:
if self.stamp and os.path.exists(self.stamp.path):
process_img(self.stamp, size=STAMP_IMG_SIZE)
if self.logo:
if self.logo and os.path.exists(self.logo.path):
process_img(self.logo, size=LOGO_SIZE)
def is_ip(self):

@ -28,7 +28,7 @@ def check_one_profile(profile, now, manual=False):
profile.active = True
else:
profile.active = False
profile.save()
profile.save(update_fields=['active'])
user_email = profile.users.get().email

@ -772,6 +772,7 @@ class BaseItemsViews(BaseViews):
self.set_item_formset_class(extra_count=len(kwargs['initial_items']))
return self.add(self.request, *args, **kwargs)
@method_decorator(license_required)
@method_decorator(csrf_protect)
def edit(self, *args, **kwargs):
"""Редактировать документ."""

@ -6,6 +6,7 @@
<a class="doc email-link" href="{{ url_email }}">Отправить по e-mail</a>
<a class="doc edit-link" href="{{ url_edit }}">Редактировать документ</a>
<a class="doc delete-link" href="{{ url_delete }}">Удалить документ</a>

Loading…
Cancel
Save