# Path: quotes/models.py
# class Quote(models.Model):
#         body = models.TextField()
#         authors = models.ManyToManyField(Author)
#         tags = models.ManyToManyField(Tag, blank=True, null=True)
#         slug = models.SlugField(max_length=100, blank=True)
#         publish_date = models.DateTimeField(default=datetime.now)
#         source = models.TextField(null=True, blank=True)
#         featured = models.BooleanField(default=False)
#         uuid = models.CharField(max_length=100, blank=True, null=True)
# 
#         class Meta:
#             ordering = ['-publish_date']
# 
#         def __unicode__(self):
#             return self.body
# 
#         def get_absolute_url(self):
#             return reverse('quote', kwargs={'uuid': self.uuid})
# 
#         def serialize(self):
#             return {
#                 'body': self.body,
#                 'url': self.get_absolute_url(),
#                 'authors': [
#                     {
#                         'name': author.name,
#                         'url': author.get_absolute_url(),
#                         'avatar': author.get_avatar(),
#                     }
#                     for author in self.authors.all()
#                 ],
#                 'tags': [
#                     {
#                         'name': tag.name,
#                         'url': tag.get_absolute_url(),
#                     }
#                     for tag in self.tags.all()
#                 ]
#             }


from django.contrib.syndication.views import Feed
from quotes.models import Quote
import re
# coding: utf-8


class LatestEntriesFeed(Feed):
    title = "def programming: latest quotes"
    link = "/"
    description = "Latest published quotes from defprogramming.com"

    def items(self):

# Path: quotes/models.py
# class Quote(models.Model):
#         body = models.TextField()
#         authors = models.ManyToManyField(Author)
#         tags = models.ManyToManyField(Tag, blank=True, null=True)
#         slug = models.SlugField(max_length=100, blank=True)
#         publish_date = models.DateTimeField(default=datetime.now)
#         source = models.TextField(null=True, blank=True)
#         featured = models.BooleanField(default=False)
#         uuid = models.CharField(max_length=100, blank=True, null=True)
# 
#         class Meta:
#             ordering = ['-publish_date']
# 
#         def __unicode__(self):
#             return self.body
# 
#         def get_absolute_url(self):
#             return reverse('quote', kwargs={'uuid': self.uuid})
# 
#         def serialize(self):
#             return {
#                 'body': self.body,
#                 'url': self.get_absolute_url(),
#                 'authors': [
#                     {
#                         'name': author.name,
#                         'url': author.get_absolute_url(),
#                         'avatar': author.get_avatar(),
#                     }
#                     for author in self.authors.all()
#                 ],
#                 'tags': [
#                     {
#                         'name': tag.name,
#                         'url': tag.get_absolute_url(),
#                     }
#                     for tag in self.tags.all()
#                 ]
#             }


# Path: quotes/feeds.py
from django.contrib.syndication.views import Feed
from quotes.models import Quote
import re

# coding: utf-8


class LatestEntriesFeed(Feed):
    title = "def programming: latest quotes"
    link = "/"
    description = "Latest published quotes from defprogramming.com"

    def items(self):

        return Quote.objects.order_by('-publish_date')[:20]