|
|
|
|
@ -179,8 +179,8 @@ def send_child_birthday_email_and_bonuses(): |
|
|
|
|
|
|
|
|
|
@app.task |
|
|
|
|
def send_camp_certificates(email=None, dry_run=False, certificate_number=None): |
|
|
|
|
path_pattern = 'img/camp-certificates/%d.jpg' |
|
|
|
|
signed_path_pattern = 'img/signed-camp-certificates/%d.jpg' |
|
|
|
|
path_pattern = 'camp-certificates/%d.jpg' |
|
|
|
|
signed_path_pattern = 'signed-camp-certificates/%d.jpg' |
|
|
|
|
color = (0, 27, 94) |
|
|
|
|
if certificate_number is None: |
|
|
|
|
certificate_number = 1 |
|
|
|
|
@ -189,7 +189,7 @@ def send_camp_certificates(email=None, dry_run=False, certificate_number=None): |
|
|
|
|
if certificate_number == 3: |
|
|
|
|
color = (24, 57, 220) |
|
|
|
|
if email: |
|
|
|
|
fn = draw_cert(staticfiles_storage.path(signed_path_pattern % certificate_number), email, 'Имя', 'Фамилия', |
|
|
|
|
fn = draw_cert(os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % certificate_number), email, 'Имя', 'Фамилия', |
|
|
|
|
font_size=120, y=1000, color=color) |
|
|
|
|
file = open(fn, 'rb') |
|
|
|
|
try: |
|
|
|
|
@ -221,12 +221,12 @@ def send_camp_certificates(email=None, dry_run=False, certificate_number=None): |
|
|
|
|
|
|
|
|
|
file_names = [] |
|
|
|
|
if un.user.child_filled: |
|
|
|
|
fn = staticfiles_storage.path(signed_path_pattern % certificate_number) |
|
|
|
|
fn = os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % certificate_number) |
|
|
|
|
for child in un.user.childs.all(): |
|
|
|
|
file_names.append(draw_cert(fn, un.user.email, child.first_name, child.last_name, |
|
|
|
|
font_size=120, y=1000, color=color)) |
|
|
|
|
else: |
|
|
|
|
file_names.append(staticfiles_storage.path(path_pattern % certificate_number)) |
|
|
|
|
file_names.append(os.path.join(settings.RESOURCES_ROOT, path_pattern % certificate_number)) |
|
|
|
|
files = [open(fn, 'rb') for fn in file_names] |
|
|
|
|
try: |
|
|
|
|
send_email('Грамота от Lil School', un.user.email, 'notification/email/camp_certificate.html', |
|
|
|
|
|