Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9227351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:03:17+00:00 2026-06-18T05:03:17+00:00

I’m building a django app that has users come to my site, enter in

  • 0

I’m building a django app that has users come to my site, enter in a string of text, their email, a friend’s email and a date they would like to be emailed on.

How would I go about having the text they entered emailed to the them on the date they requested in the date_returned field? Any specific apps? Loops? Etc

Thank you,

My Models.py looks like:

class bet(models.Model):
name = models.CharField(max_length=100)
email_1 = models.EmailField()
email_2 = models.EmailField()
wager = models.CharField(max_length=300)
date_submitted = models.DateField(_("Date"), auto_now_add=True) 
date_returned = models.DateField(null=True)

def __unicode__(self):
    return self.name

class BetForm(ModelForm):
name = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Bet Name'}),      max_length=100)
email_1 = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': 'Your Email'}))
email_2 = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': 'Your Friend\'s Email'}))
wager = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'What\'s The Wager?'}), max_length=200)
date_returned = forms.DateField(widget=SelectDateWidget())
class Meta:
    model=bet
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:03:20+00:00Added an answer on June 18, 2026 at 5:03 am

    In django and python it is easy to send an email so I won’t get into that. Your problem of sending an email at some particular event is not the job of a web application. I would recommend setting up a cron job that calls a django command (https://docs.djangoproject.com/en/dev/howto/custom-management-commands/). Write a simple command to dequeue events that are about to occur and send out the appropriate email. Have the cron run at a regular enough interval to simulate real time.

    models.py

    class Bet(models.Model):
        name = models.CharField(max_length=100)
        email_1 = models.EmailField()
        email_2 = models.EmailField()
        wager = models.CharField(max_length=300)
        date_submitted = models.DateField(_("Date"), auto_now_add=True) 
        date_returned = models.DateField(null=True)
        email_sent = model.BooleanField(default=False)
    

    dequeueemail.py

    from django.core.management.base import BaseCommand, CommandError
    from app_name.models import bet 
    
    class Command(BaseCommand):
        def handle(self, *args, **options):
            for bet in bet.objects.filter(date_returned__gt=datetime.datetime.now(),email_sent=False):
                #python code to send email
                bet.email_sent=True
                bet.save()
    

    crontab

    * * * * * python manage.py dequeueemail

    If you want to hack this without actually installing a cron check this app out (http://code.google.com/p/django-cron/)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.