2

I have a Django site and once a week, I'd like to query the database and send an email based on that query.

It's a library site, and I want to query the list of users, find each user's checked-out books, and email each user.

The process is something like this (pseudocode):

for user in users:
    get user.email_address
    get user.books
    get intro_text and from_address (global for the site)
    create email for user
    send email

There's also the complication that intro_text and from_address need to be configurable through the admin interface. I'm planning to store these in the database, rather than in settings.py.

I'm guessing I should create this as a Django management task that I can then run as a cron job - would that be a sensible approach?

Thanks for your help.

1
  • hi, can you please explain how can i do it in little more detail. I am also implementing something like this, where i have to query database to get the user emails and messages and send them email at a particular time each day. I would really appreciate if you could provide details regarding setting up django task and setting up cron job. Thank you Commented Jan 27, 2012 at 9:52

1 Answer 1

1

Yes, management task + cron job is the way to go here.

Sign up to request clarification or add additional context in comments.

1 Comment

@daniel hi can you give more details as to how can i implement this i.e query database to get user emails and then at a particular time each day send out email.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.