Skip to content
This repository
Browse code

allowed email subject to be editable

  • Loading branch information...
commit b7d3fc0adca78bcba559bf1c1b0948058c570116 1 parent 4a92c64
jebixly authored January 12, 2013
3  tendenci/addons/events/forms.py
@@ -1469,6 +1469,7 @@ def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
1469 1469
 
1470 1470
 class MessageAddForm(forms.ModelForm):
1471 1471
     #events = forms.CharField()
  1472
+    subject = forms.CharField(widget=forms.TextInput(attrs={'style':'width:100%;padding:5px 0;'}))
1472 1473
     body = forms.CharField(widget=TinyMCE(attrs={'style':'width:100%'},
1473 1474
         mce_attrs={'storme_app_label':Email._meta.app_label,
1474 1475
         'storme_model':Email._meta.module_name.lower()}),
@@ -1485,7 +1486,7 @@ class MessageAddForm(forms.ModelForm):
1485 1486
 
1486 1487
     class Meta:
1487 1488
         model = Email
1488  
-        fields = ('body',)
  1489
+        fields = ('subject', 'body',)
1489 1490
 
1490 1491
     def __init__(self, event_id=None, *args, **kwargs):
1491 1492
         super(MessageAddForm, self).__init__(*args, **kwargs)
6  tendenci/addons/events/templates/events/message/add.html
@@ -29,7 +29,13 @@
29 29
 
30 30
     		<div class="message-item"><a href="{% url event.registrant.roster event.id %}">{% trans "View all registrant(s)" %}</a></div>
31 31
     		
  32
+            <div class="message-item">
  33
+                <p><strong>{{ form.subject.label }}:</strong></p>
  34
+                {{ form.subject }}
  35
+            </div>
  36
+
32 37
     		<div class="message-item">
  38
+                <p><strong>{{ form.body.label }}:</strong></p>
33 39
     			{{ form.body }}
34 40
     		</div>
35 41
     		
3  tendenci/addons/events/templates/events/message/subject-text.txt
... ...
@@ -0,0 +1,3 @@
  1
+{% load i18n %}
  2
+
  3
+{{ event.title }} {% trans "notice from" %} {{ SITE_GLOBAL_SITEDISPLAYNAME }}
5  tendenci/addons/events/views.py
@@ -2538,7 +2538,6 @@ def message_add(request, event_id, form_class=MessageAddForm, template_name='eve
2538 2538
             email.reply_to = request.user.email
2539 2539
             email.recipient = request.user.email
2540 2540
             email.content_type = "text/html"
2541  
-            email.subject = '%s notice from %s' % (event.title, get_setting('site', 'global', 'sitedisplayname'))
2542 2541
             email.save(request.user)
2543 2542
             subject = email.subject
2544 2543
 
@@ -2573,9 +2572,11 @@ def message_add(request, event_id, form_class=MessageAddForm, template_name='eve
2573 2572
             return HttpResponseRedirect(reverse('event', args=([event_id])))
2574 2573
 
2575 2574
     else:
  2575
+        defaultsubject = render_to_string('events/message/subject-text.txt', {'event': event},
  2576
+            context_instance=RequestContext(request))
2576 2577
         openingtext = render_to_string('events/message/opening-text.txt', {'event': event},
2577 2578
             context_instance=RequestContext(request))
2578  
-        form = form_class(event.id, initial={'body': openingtext})
  2579
+        form = form_class(event.id, initial={'subject':defaultsubject, 'body': openingtext})
2579 2580
 
2580 2581
     return render_to_response(template_name, {
2581 2582
         'event':event,

0 notes on commit b7d3fc0

Please sign in to comment.
Something went wrong with that request. Please try again.