def remind_accounts_about_events(): hots = AccountReminding.hots.existing() for reminding in hots: remind_account_about_events(reminding.account, SingleEvent.future_events.filter(id=reminding.single_event.id)) reminding.processed() return hots
def remind_accounts_about_events_on_week_day(): accounts = Account.objects.extra(where=['reminder_type_state & %s != 0' % REMINDER_TYPES['WEEKDAY']['id']])\ .filter(reminder_on_week_day=str(datetime.now().weekday())) for account in accounts: single_events = account.reminder_single_events.filter(start_time__gte=datetime.now(), start_time__lte=(datetime.now() + timedelta(days=7))) if len(single_events) > 0: remind_account_about_events(account, single_events)
def remind_accounts_about_events(): hots = AccountReminding.hots.existing() for reminding in hots: remind_account_about_events( reminding.account, SingleEvent.future_events.filter(id=reminding.single_event.id)) reminding.processed() return hots
def remind_accounts_about_events_on_week_day(): accounts = Account.objects.extra(where=['reminder_type_state & %s != 0' % REMINDER_TYPES['WEEKDAY']['id']])\ .filter(reminder_on_week_day=str(datetime.now().weekday())) for account in accounts: single_events = account.reminder_single_events.filter( start_time__gte=datetime.now(), start_time__lte=(datetime.now() + timedelta(days=7))) if len(single_events) > 0: remind_account_about_events(account, single_events)
def remind_accounts_about_events_on_week_day(): for account in Account.objects.filter( reminder_active_type="WEEKDAY", reminder_on_week_day=str(datetime.now().weekday()) ): single_events = account.reminder_single_events.filter( start_time__gte=datetime.now(), start_time__lte=(datetime.now() + timedelta(days=7)) ) if len(single_events) > 0: remind_account_about_events(account, single_events)
def remind_preview(request): message = remind_account_about_events( Account.objects.get(user__email="*****@*****.**"), SingleEvent.future_events.all()[0:1] ) return HttpResponse(message)
def remind_preview(request): message = remind_account_about_events( Account.objects.get(user__email="*****@*****.**"), SingleEvent.future_events.all()[0:1]) return HttpResponse(message)