Skip to content

Commit

Permalink
Move "generated by Tendenci" email footer to a template include.
Browse files Browse the repository at this point in the history
Currently this email footer is defined in a number of places in both Python code
and Django templates. This change centralizes the footer into a single location
that can be overridden with templates.
  • Loading branch information
BenSturmfels committed Jun 5, 2017
1 parent a7faacc commit 2b2e6f8
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 90 deletions.
Expand Up @@ -265,7 +265,7 @@ def email_member(notice, membership, global_context):

body = fieldify(body)

body = '%s <br /><br />%s' % (body, get_footer())
body = body + ' <br /><br />{% include "email_footer.html" %}'

context = Context(context)
template = Template(body)
Expand Down Expand Up @@ -295,14 +295,6 @@ def email_member(notice, membership, global_context):
print 'To ', email_recipient, subject
return sent

def get_footer():
return """
This e-mail was generated by Tendenci&reg; Software -
a web based membership management software solution
www.tendenci.com developed by Schipul - The Web
Marketing Company
"""

exception_str = ""

notices = Notice.objects.filter(status=True, status_detail='active'
Expand Down
14 changes: 3 additions & 11 deletions tendenci/apps/corporate_memberships/models.py
Expand Up @@ -1726,14 +1726,6 @@ class Meta:
def __unicode__(self):
return self.notice_name

@property
def footer(self):
return """
This e-mail was generated by Tendenci&reg; Software - a
web based membership management software solution
www.tendenci.com developed by Schipul - The Web Marketing Company
"""

def get_default_context(self, corporate_membership=None,
recipient=None, **kwargs):
"""
Expand Down Expand Up @@ -1831,10 +1823,10 @@ def get_subject(self, corporate_membership=None, recipient=None):

def get_content(self, corporate_membership=None, recipient=None, **kwargs):
"""
Return self.email_content with self.footer appended
and replace shortcode (context) variables
Return self.email_content with footer appended and replace shortcode
(context) variables
"""
content = "%s\n<br /><br />\n%s" % (self.email_content, self.footer)
content = self.email_content + '\n<br /><br />\n{% include "email_footer.html" %}'
context = self.get_default_context(corporate_membership, recipient, **kwargs)

return self.build_notice(content, context=context, **kwargs)
Expand Down
Expand Up @@ -37,10 +37,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% blocktrans %}
This e-mail was generated by Tendenci&reg; Software - a web based membership management software solution
<a href="http://www.tendenci.com">www.tendenci.com</a> developed by <a href="http://schipul.com">Schipul - The Web Marketing Company</a>
{% endblocktrans %}
</p>

{% include email_footer.html %}
Expand Up @@ -257,7 +257,7 @@ def email_member(notice, membership, global_context):

body = fieldify(body)

body = '%s <br /><br />%s' % (body, get_footer())
body = body + ' <br /><br />{% include "email_footer.html" %}'

context = Context(context)
template = Template(body)
Expand All @@ -284,14 +284,6 @@ def email_member(notice, membership, global_context):
if verbosity > 1:
print 'To ', email_recipient, subject

def get_footer():
return """
This e-mail was generated by Tendenci&reg; Software -
a web based membership management software solution
www.tendenci.com developed by Schipul - The Web
Marketing Company
"""

exception_str = ""

notices = Notice.objects.filter(status=True, status_detail='active'
Expand Down
14 changes: 3 additions & 11 deletions tendenci/apps/memberships/models.py
Expand Up @@ -2093,14 +2093,6 @@ class Meta:
def __unicode__(self):
return self.notice_name

@property
def footer(self):
return """
This e-mail was generated by Tendenci&reg; Software - a
web based membership management software solution
www.tendenci.com developed by Schipul - The Web Marketing Company
"""

def get_default_context(self, membership=None):
"""
Returns a dictionary with default context items.
Expand Down Expand Up @@ -2169,10 +2161,10 @@ def get_subject(self, membership=None):

def get_content(self, membership=None):
"""
Return self.email_content with self.footer appended
and replace shortcode (context) variables
Return self.email_content with footer appended and replace shortcode
(context) variables
"""
content = "%s\n<br /><br />\n%s" % (self.email_content, self.footer)
content = self.email_content + '\n<br /><br />\n{% include "email_footer.html" %}'
context = self.get_default_context(membership)

return self.build_notice(content, context=context)
Expand Down
Expand Up @@ -37,10 +37,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% blocktrans %}
This e-mail was generated by Tendenci&reg; Software - a web based membership management software solution
<a href="http://www.tendenci.com">www.tendenci.com</a> developed by <a href="http://schipul.com">Schipul - The Web Marketing Company</a>
{% endblocktrans %}
</p>

{% include email_footer.html %}
Expand Up @@ -15,9 +15,6 @@
{{ SITE_GLOBAL_SITECONTACTNAME }} <br />
{{ SITE_GLOBAL_SITECONTACTEMAIL }} <br />
{{ SITE_GLOBAL_SITEDISPLAYNAME }} <br />
{% trans "Time Submitted:" %} {% now "D d M Y P" %} <br />
<br />
{% blocktrans %}
This e-mail was generated by Tendenci&reg; Software - a web based membership management software solution
<a href="http://www.tendenci.com">www.tendenci.com</a> developed by <a href="http://schipul.com">Schipul - The Web Marketing Company</a>
{% endblocktrans %}
<p>{% trans "Time Submitted:" %} {% now "D d M Y P" %}</p>

{% include email_footer.html %}
Expand Up @@ -24,8 +24,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "www.tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
Expand Up @@ -23,8 +23,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "www.tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
Expand Up @@ -67,8 +67,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "www.tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
Expand Up @@ -22,8 +22,4 @@

<P>{{ site_display_name }}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "www.tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
Expand Up @@ -61,8 +61,4 @@

<P>{{ site_display_name }}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
Expand Up @@ -63,8 +63,4 @@

<P>{% trans "Time submitted:" %} {% now "D d M Y P" %}</P>

<p align="center">
{% trans "This e-mail was generated by Tendenci&reg; Software - a" %}
{% trans "web based membership management software solution" %}
{% trans "www.tendenci.com developed by Schipul - The Web Marketing Company" %}
</p>
{% include email_footer.html %}
7 changes: 7 additions & 0 deletions tendenci/templates/email_footer.html
@@ -0,0 +1,7 @@
{% load i18n %}
<p align="center">
{% blocktrans %}
This e-mail was generated by Tendenci&reg; Software - a web based membership management software solution
<a href="http://www.tendenci.com">www.tendenci.com</a> developed by <a href="http://schipul.com">Schipul - The Web Marketing Company</a>
{% endblocktrans %}
</p>

0 comments on commit 2b2e6f8

Please sign in to comment.