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 index(request): """ Simple index page for the admin site. """ site_settings = SiteSettings.objects.get_current() total_count = tiers.current_videos_that_count_toward_limit().count() percent_videos_used = math.floor( (100.0 * total_count) / site_settings.tierinfo.get().videos_limit()) videos_this_week_count = Video.objects.filter( status=Video.ACTIVE, when_approved__gt=(datetime.datetime.utcnow() - datetime.timedelta(days=7)) ).count() return render_to_response( 'localtv/admin/index.html', {'total_count': total_count, 'percent_videos_used': percent_videos_used, 'unreviewed_count': Video.objects.filter( status=Video.UNAPPROVED, site=site_settings.site).count(), 'videos_this_week_count': videos_this_week_count, 'comment_count': comments.get_model().objects.filter( is_public=False, is_removed=False).count()}, context_instance=RequestContext(request))