# Path: feedme/models.py
# class FeedItem(models.Model):
#     """
#     FeedItem Model
#     """
#     title = models.CharField(max_length=350, blank=True)
#     link = models.URLField(blank=True)
#     content = models.TextField(blank=True)
#     feed = models.ForeignKey(Feed, blank=True, null=True)
#     read = models.BooleanField(default=False)
#     guid = models.CharField(max_length=255)
#     date_fetched = models.DateField(auto_created=True, auto_now_add=True, editable=True)
#     pub_date = models.DateTimeField()
# 
#     objects = FeedItemManager()
# 
#     class Meta:
#         ordering = ['id']
# 
#     def __str__(self):
#         return self.title
# 
#     def mark_as_read(self):
#         """
#         Mark an item as read.
#         """
#         self.read = True
#         self.save()


from django.template import loader, Context
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from .models import FeedItem
"""
Django Feedme

Digest.py

Author: Derek Stegelman
"""
from __future__ import unicode_literals



def send_digest():
    """
    Send the daily digest for all users.  This sends
    both a .txt and .html version of the email.
    :return:
    """
    text_template = loader.get_template('feedme/mail/digest.txt')
    html_template = loader.get_template('feedme/mail/digest.html')
    subject = 'Daily FeedMe Digest'

    for user in User.objects.all():

# Path: feedme/models.py
# class FeedItem(models.Model):
#     """
#     FeedItem Model
#     """
#     title = models.CharField(max_length=350, blank=True)
#     link = models.URLField(blank=True)
#     content = models.TextField(blank=True)
#     feed = models.ForeignKey(Feed, blank=True, null=True)
#     read = models.BooleanField(default=False)
#     guid = models.CharField(max_length=255)
#     date_fetched = models.DateField(auto_created=True, auto_now_add=True, editable=True)
#     pub_date = models.DateTimeField()
# 
#     objects = FeedItemManager()
# 
#     class Meta:
#         ordering = ['id']
# 
#     def __str__(self):
#         return self.title
# 
#     def mark_as_read(self):
#         """
#         Mark an item as read.
#         """
#         self.read = True
#         self.save()


# Path: feedme/digest.py
from django.template import loader, Context
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from .models import FeedItem

"""
Django Feedme

Digest.py

Author: Derek Stegelman
"""
from __future__ import unicode_literals



def send_digest():
    """
    Send the daily digest for all users.  This sends
    both a .txt and .html version of the email.
    :return:
    """
    text_template = loader.get_template('feedme/mail/digest.txt')
    html_template = loader.get_template('feedme/mail/digest.html')
    subject = 'Daily FeedMe Digest'

    for user in User.objects.all():

        items = FeedItem.objects.my_feed_items(user).yesterday()