我正在构建一个 django 应用程序,让用户访问我的网站,输入一串文本、他们的电子邮件、朋友的电子邮件以及他们希望收到电子邮件的日期。
我将如何在他们在 date_returned 字段中请求的日期将他们输入的文本通过电子邮件发送给他们?有什么具体的应用吗?循环?ETC
谢谢,
我的 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)
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