def handle(self, *args, **options): ti = models.TierInfo.objects.get_current() if ti.already_sent_tiers_compliance_email: return warnings = tiers.user_warnings_for_downgrade(ti.tier_name) ### Hack ### Override the customtheme warning for this email with custom code if 'customtheme' in warnings: warnings.remove('customtheme') default_non_bundled_themes = uploadtemplate.models.Theme.objects.filter(default=True, bundled=False) if default_non_bundled_themes: warnings.add('customtheme') tier = ti.get_tier() ### Hack ### override the customdomain warning, too if (ti.site_settings.site.domain and not ti.site_settings.site.domain.endswith('mirocommunity.org') and not tier.permits_custom_domain()): warnings.add('customdomain') data = {'warnings': warnings} data['would_lose_admin_usernames'] = tiers.push_number_of_admins_down( tier.admins_limit()) data['videos_over_limit'] = tiers.hide_videos_above_limit(tier) data['video_count'] = tiers.current_videos_that_count_toward_limit().count() tiers.send_tiers_related_multipart_email( 'Changes to your Miro Community site', 'mirocommunity_saas/tiers_emails/too_big_for_your_tier.txt', ti, extra_context=data) ti.already_sent_tiers_compliance_email = True ti.save()
def actually_send(self, tier_info, extra_context): # If we haven't sent it, prepare the email # Now send the sucker subject = "%s: Welcome to Miro Community" % tier_info.site_settings.site.name if tier_info.tier_name == 'basic': template = 'mirocommunity_saas/tiers_emails/welcome_to_your_site_basic.txt' else: template = 'mirocommunity_saas/tiers_emails/welcome_to_your_site.txt' tiers.send_tiers_related_multipart_email(subject, template, tier_info, extra_context=extra_context) # Finally, save a note saying we sent it. tier_info.already_sent_welcome_email = True tier_info.save()