from django.db import models
from forum.utils.mail import send_template_email
from django.core.management.base import NoArgsCommand
from django.db import models
from forum.utils.mail import send_template_email
from django.core.management.base import NoArgsCommand
class DigestQuestionsIndex(object):
def __init__(self, from_date):
self.from_date = from_date
class DigestQuestionsIndex(object):
def __init__(self, from_date):
self.from_date = from_date
'LAST_DAILY': datetime.datetime.now() - datetime.timedelta(days=1),
'LAST_WEEKLY': datetime.datetime.now() - datetime.timedelta(days=1),
'LAST_DAILY': datetime.datetime.now() - datetime.timedelta(days=1),
'LAST_WEEKLY': datetime.datetime.now() - datetime.timedelta(days=1),
- from_date = digest_control.value['LAST_DAILY']
- digest_control.value['LAST_DAILY'] = datetime.datetime.now()
+ from_date = digest_control['LAST_DAILY']
+ digest_control['LAST_DAILY'] = datetime.datetime.now()
new_members = User.objects.filter(is_active=True, date_joined__gt=from_date).annotate(n_actions=models.Count('actions')).order_by('-n_actions')
new_member_count = new_members.count()
new_members = User.objects.filter(is_active=True, date_joined__gt=from_date).annotate(n_actions=models.Count('actions')).order_by('-n_actions')
new_member_count = new_members.count()
if new_member_count >= SHOW_N_MORE_ACTIVE_NEW_MEMBERS:
new_members = new_members[:SHOW_N_MORE_ACTIVE_NEW_MEMBERS]
show_all_users = True
if new_member_count >= SHOW_N_MORE_ACTIVE_NEW_MEMBERS:
new_members = new_members[:SHOW_N_MORE_ACTIVE_NEW_MEMBERS]
show_all_users = True