# Path: blog/models.py
# class Post(models.Model):
#     title = models.CharField(max_length=63)
#     slug = models.SlugField(
#         max_length=63,
#         help_text='A label for URL config',
#         unique_for_month='pub_date')
#     author = models.ForeignKey(
#         settings.AUTH_USER_MODEL,
#         related_name='blog_posts')
#     text = models.TextField()
#     pub_date = models.DateField(
#         'date published',
#         auto_now_add=True)
#     tags = models.ManyToManyField(
#         Tag,
#         blank=True,
#         related_name='blog_posts')
#     startups = models.ManyToManyField(
#         Startup,
#         blank=True,
#         related_name='blog_posts')
# 
#     objects = PostManager()
# 
#     class Meta:
#         verbose_name = 'blog post'
#         ordering = ['-pub_date', 'title']
#         get_latest_by = 'pub_date'
#         permissions = (
#             ("view_future_post",
#              "Can view unpublished Post"),
#         )
#         index_together = (
#             ('slug', 'pub_date'),
#         )
# 
#     def __str__(self):
#         return "{} on {}".format(
#             self.title,
#             self.pub_date.strftime('%Y-%m-%d'))
# 
#     def get_absolute_url(self):
#         return reverse(
#             'blog_post_detail',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def get_archive_month_url(self):
#         return reverse(
#             'blog_post_archive_month',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month})
# 
#     def get_archive_year_url(self):
#         return reverse(
#             'blog_post_archive_year',
#             kwargs={'year': self.pub_date.year})
# 
#     def get_delete_url(self):
#         return reverse(
#             'blog_post_delete',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def get_update_url(self):
#         return reverse(
#             'blog_post_update',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def natural_key(self):
#         return (
#             self.pub_date,
#             self.slug)
#     natural_key.dependencies = [
#         'organizer.startup',
#         'organizer.tag',
#         'user.user',
#     ]
# 
#     def formatted_title(self):
#         return self.title.title()
# 
#     def short_text(self):
#         if len(self.text) > 20:
#             short = ' '.join(self.text.split()[:20])
#             short += ' ...'
#         else:
#             short = self.text
#         return short


from datetime import datetime
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.utils.feedgenerator import (
    Atom1Feed, Rss201rev2Feed)
from .models import Post




class BasePostFeedMixin():
    title = "Latest Startup Organizer Blog Posts"
    link = reverse_lazy('blog_post_list')
    description = subtitle = (
        "Stay up to date on the "
        "hottest startup news.")

    def items(self):
        # uses Post.Meta.ordering

# Path: blog/models.py
# class Post(models.Model):
#     title = models.CharField(max_length=63)
#     slug = models.SlugField(
#         max_length=63,
#         help_text='A label for URL config',
#         unique_for_month='pub_date')
#     author = models.ForeignKey(
#         settings.AUTH_USER_MODEL,
#         related_name='blog_posts')
#     text = models.TextField()
#     pub_date = models.DateField(
#         'date published',
#         auto_now_add=True)
#     tags = models.ManyToManyField(
#         Tag,
#         blank=True,
#         related_name='blog_posts')
#     startups = models.ManyToManyField(
#         Startup,
#         blank=True,
#         related_name='blog_posts')
# 
#     objects = PostManager()
# 
#     class Meta:
#         verbose_name = 'blog post'
#         ordering = ['-pub_date', 'title']
#         get_latest_by = 'pub_date'
#         permissions = (
#             ("view_future_post",
#              "Can view unpublished Post"),
#         )
#         index_together = (
#             ('slug', 'pub_date'),
#         )
# 
#     def __str__(self):
#         return "{} on {}".format(
#             self.title,
#             self.pub_date.strftime('%Y-%m-%d'))
# 
#     def get_absolute_url(self):
#         return reverse(
#             'blog_post_detail',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def get_archive_month_url(self):
#         return reverse(
#             'blog_post_archive_month',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month})
# 
#     def get_archive_year_url(self):
#         return reverse(
#             'blog_post_archive_year',
#             kwargs={'year': self.pub_date.year})
# 
#     def get_delete_url(self):
#         return reverse(
#             'blog_post_delete',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def get_update_url(self):
#         return reverse(
#             'blog_post_update',
#             kwargs={'year': self.pub_date.year,
#                     'month': self.pub_date.month,
#                     'slug': self.slug})
# 
#     def natural_key(self):
#         return (
#             self.pub_date,
#             self.slug)
#     natural_key.dependencies = [
#         'organizer.startup',
#         'organizer.tag',
#         'user.user',
#     ]
# 
#     def formatted_title(self):
#         return self.title.title()
# 
#     def short_text(self):
#         if len(self.text) > 20:
#             short = ' '.join(self.text.split()[:20])
#             short += ' ...'
#         else:
#             short = self.text
#         return short


# Path: blog/feeds.py
from datetime import datetime
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.utils.feedgenerator import (
    Atom1Feed, Rss201rev2Feed)
from .models import Post





class BasePostFeedMixin():
    title = "Latest Startup Organizer Blog Posts"
    link = reverse_lazy('blog_post_list')
    description = subtitle = (
        "Stay up to date on the "
        "hottest startup news.")

    def items(self):
        # uses Post.Meta.ordering

        return Post.objects.published()[:10]