kelvan avatar kelvan committed 05afcb9

moved newexpert notification mail to template

Comments (0)

Files changed (2)


+Name: {{ }}
+Email: {{ }}
+{{ }}
+{{ expert.description }}
+View and accept (set available to True)
+{{ }}
+Yours sincerely, Notification Service


 from django.http import HttpResponseRedirect
 from django.core.mail import EmailMessage
 from django.contrib.auth.models import User
+from django.template.loader import get_template
+from django.template import Context
 from import ExpertProfileForm
 from freieit import settings
             expert.available = False
             expert.user = u
-            email_msg = """
-            Name:
-            %(name)s
-            Services:
-            %(services)s
-            View and accept (set available to True)
-            """ % expert.__dict__
+            tpl = get_template('newexpert.txt')
+            email_msg = tpl.render(Context({'expert': expert}))
             subject = "[New expert] %s" %
-            email_from = email
+            email_from = settings.DEFAULT_FROM_EMAIL
             email_to = settings.DEFAULT_FROM_EMAIL
             email = EmailMessage(subject, email_msg, email_from, [email_to])
             #if 'image' in request.FILES:
             #    img = request.FILES['image']
             #    email.attach(,, img.content_type)
             return render(request, 'newexpert.html', {'expert': expert})
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.