通过django上的电子邮件发送确认链接

时间:2013-12-30 07:52:43

标签: django django-email

我正在尝试通过django中的确认链接向用户发送邮件以接受朋友请求。

任何帮助将不胜感激

view.py

def profile(request,User_id):    
    if form1.is_valid():
        form1 = form1.save(commit=False)
        form1.creator = request.user
        form1.save()
        send_mail('Friend Request', 'You have a friend request.',request.user.email,[form1.friend.email],
                fail_silently=False)

models.py

class Friendship(models.Model):
    RESPONSE_CHOICES = (
    ('Inactive','Inactive'),
    ('Active','Active'),
    )
   response = models.CharField(max_length=10,choices=RESPONSE_CHOICES,default='Inactive')
    creator = models.ForeignKey(User, related_name="friendship_creator_set")
    friend = models.ForeignKey(User, related_name="friend_set")    

0 个答案:

没有答案