From f691ef58933bf33033389a1a468f655af19c1e16 Mon Sep 17 00:00:00 2001 From: holyantony Date: Fri, 8 May 2015 11:59:21 +0530 Subject: Subject: Profile updation and Email notification Description: 1. Confirmation link on registration via email 2. Profile updation on registration confirmation 3. Email notification posting question and answer --- website/models.py | 12 +++++++++++- website/views.py | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'website') diff --git a/website/models.py b/website/models.py index da87cb5..c7e43aa 100644 --- a/website/models.py +++ b/website/models.py @@ -3,7 +3,7 @@ from django.db import models from django.contrib.auth.models import User from django.contrib.auth import get_user_model -User = get_user_model() + class FossCategory(models.Model): name = models.CharField(max_length=100) @@ -85,3 +85,13 @@ class Notification(models.Model): def poster(self): user = User.objects.get(id=self.pid) return user.username + +class Profile(models.Model): + user = models.ForeignKey(User) + confirmation_code = models.CharField(max_length=255) + phone = models.CharField(max_length=20, null=True) + address = models.TextField(null=True) + created = models.DateTimeField(auto_now_add=True) + + class Meta: + app_label = 'website' diff --git a/website/views.py b/website/views.py index 3009a6a..de93b7f 100644 --- a/website/views.py +++ b/website/views.py @@ -251,7 +251,8 @@ def new_question(request): question.body = cleaned_data['body'].encode('unicode_escape') question.views= 1 question.save() - + print "question" + print question.id # Sending email when a new question is asked subject = 'New Forum Question' message = """ @@ -271,6 +272,8 @@ def new_question(request): ['team@fossee.in'], headers={"Content-type":"text/html;charset=iso-8859-1"} ) + print message + print "****************" email.attach_alternative(message, "text/html") email.send(fail_silently=True) # End of email send -- cgit