src/cm/models_utils.py
author Simon Descarpentries <sid@sopinspace.com>
Fri, 20 Sep 2013 16:28:40 +0200
changeset 536 0c625ce49a81
parent 0 40c8f766c9b8
permissions -rw-r--r--
- updating jQuery (1.3.2 -> 1.10.2), jQuery UI, jQuery modules - [text_view_frame.html] Add some JS driven CSS tricks for iPad - [text_view_frame.html] move throbber's hiding-call in nested text_view_comments iframe onload signal (so it works with jQuery 1.10.2 and the hiding timing is good) - [text_view_frame.html][base.html] factorize req_yui.html et req_jquery.html - [main_tabs][text_tabs][f_client-min.js] rewrite jQuery UI Tabs API calls select in active - [base.css] CSS fix grey frame appearence for all tabs - hg remove bgiframe -> not loaded in templates anymore - hg remove header_custom.html -> the file has been empty since 4 years - hg remove controls.html -> the file has been empty since 4 years

# models used to internal work
from django.db import models
from django.contrib.auth.models import User

 
class Email(models.Model):
    """
    Simple (no multipart support) email storage
    """
    created = models.DateTimeField(auto_now_add=True)

    subject = models.TextField()
    body = models.TextField()
    from_email = models.TextField()
    to = models.TextField()
    bcc = models.TextField()
    message = models.TextField() #full message
    
    def get_recipents_number(self):
        from cm.utils.mail import LIST_SEP
        res = 0
        if self.to:
            res = len(self.to.split(LIST_SEP))
        if self.bcc:
            res += len(self.bcc.split(LIST_SEP))
        return res
      
    get_recipents_number.short_description = "#recipients"
    
    def __unicode__(self):
        return ' '.join([self.from_email, self.to, self.subject])