P
P
paevlk20072014-06-13 19:13:01
Django
paevlk2007, 2014-06-13 19:13:01

Django - Sending email on a specific date (event)?

Good afternoon!
I am using django_bootstrap_calendar
models.py

class CalendarEvent(models.Model):
    title = models.CharField(max_length=255, verbose_name=_('Title'))
    url = models.URLField(verbose_name=_('URL'))
    start = models.DateTimeField(verbose_name=_('Start Date'))
    end = models.DateTimeField(verbose_name=_('End Date'), blank=True)

An event is created with a start and end date for the event. If the event occurs later, then how to make an email notification about the occurrence of the event, that is, the current date coincides with the start date of the event. It turns out that something should do and compare the current date and the date of the event, in case of a match, send an email.
Any solutions?
Thanks

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
paevlk2007, 2014-06-28
@paevlk2007

I did this:
- connected 'smsaero',
- in the form of adding a new event, added send_sms, in my case:

title = title.encode('utf-8')
 start = int(mktime(start.timetuple()))
 send_sms((resp.profile.phone), (title), '2', (start))

When the user enters a new event in the calendar, an SMS notification is simultaneously created:
with the user's phone;
message header;
"2" - Signature of the sender;
date (time) of the beginning of the event.
After that, the finished SMS is waiting for its execution!
Minus: if the user made a mistake in the date, then the SMS cannot be deleted, or you need to go to the SMSAero personal account and delete it!

I
Ivan Soshnikov, 2014-06-13
@soshnikov

django.core.management.base.BaseCommand + crontab
something like this

A
Artem Kanarev, 2014-06-25
@aduchi

as an option, the celery monster that can run scheduled tasks or you can use uwsgi, he can do it too

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question