# model
email = models.EmailField(max_length=75, blank=True)
def emailname(self):
email = self.email.rpartition('@')
return email[0]
def emailserver(self):
emailserver = self.email.rpartition('@')
return emailserver[2]
# template
{% if object.email %}
<script type="text/javascript">
emailname = "{{ object.emailname }}";
emailserver = "{{ object.emailserver }}";
document.write("<a href=\'mailto:" + emailname + "@" + emailserver + "\'>" + emailname + "@" + emailserver + "</a>");
</script>
{% endif %}
# browser
name@server.com
Comments
Also check out the next snippet 1666 which performs a far more cryptic job of cloaking the text. Unfortunately with that solution using mailto: link, verbatim text remains in the source available for scraping. I think I'll try a combination of these two for ultimate transparency.
#
Realized if careful about passing different variables for email and title 1666 does entirely cloak the tag. The robots are smarter :/
#