From b131c6ba9607070aa17c731844f1fea0504fa497 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 2 Nov 2011 17:09:59 +0100 Subject: [PATCH] use template for receipt too --- pandora/item/views.py | 3 +-- pandora/user/templates/contact_receipt.txt | 7 +++++++ pandora/user/views.py | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 pandora/user/templates/contact_receipt.txt diff --git a/pandora/item/views.py b/pandora/item/views.py index edad1c22..a845832c 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -38,7 +38,7 @@ def _order_query(qs, sort, prefix='sort__'): sort.append({'operator': '+', 'key': 'director'}) elif sort[0]['key'] == 'director': sort.append({'operator': '-', 'key': 'year'}) - sort.append({'operator': '-', 'key': 'title'}) + sort.append({'operator': '+', 'key': 'title'}) elif sort[0]['key'] == 'year': sort.append({'operator': '+', 'key': 'director'}) sort.append({'operator': '+', 'key': 'title'}) @@ -46,7 +46,6 @@ def _order_query(qs, sort, prefix='sort__'): sort.append({'operator': '+', 'key': 'director'}) sort.append({'operator': '-', 'key': 'year'}) sort.append({'operator': '+', 'key': 'title'}) - for e in sort: operator = e['operator'] if operator != '-': diff --git a/pandora/user/templates/contact_receipt.txt b/pandora/user/templates/contact_receipt.txt new file mode 100644 index 00000000..99e5f4be --- /dev/null +++ b/pandora/user/templates/contact_receipt.txt @@ -0,0 +1,7 @@ +{{name}}, +thanks for your message, we will get back to you shortly. +here your message for forther reference +{{message}} + +-- +{{sitename}} diff --git a/pandora/user/views.py b/pandora/user/views.py index bd46968d..207d4ac3 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -561,7 +561,14 @@ def contact(request): if request.user.is_authenticated() \ and 'receipt' in data \ and data['receipt']: - message = data['message'].strip() + template = loader.get_template('contact_receipt.txt') + context = RequestContext(request, { + 'email': email, + 'message': data['message'].strip(), + 'name': name, + 'sitename': settings.SITENAME, + }) + message = template.render(context) try: send_mail(subject.strip(), message, email_from, [email]) except: