# Path: weechat/news/models.py
# class Info(models.Model):
#     """A WeeChat info."""
#     visible = models.BooleanField(default=False)
#     date = models.DateTimeField()
#     title = models.CharField(max_length=64)
#     author = models.CharField(max_length=256)
#     mail = models.EmailField(max_length=256)
#     text = models.TextField(blank=True)
# 
#     def __str__(self):
#         return f'{self.title} ({self.date})'
# 
#     def date_l10n(self):
#         """Return the info date formatted with localized date format."""
#         return localdate(self.date)
# 
#     def title_i18n(self):
#         """Return translated title."""
#         match = PATTERN_TITLE_VERSION.match(self.title)
#         if match:
#             # if the title is "Version x.y.z", translate only "Version"
#             return f'{gettext(match.group(1))} {match.group(2)}'
#         return gettext(self.title)
# 
#     def text_i18n(self):
#         """Return translated text."""
#         if self.text:
#             return gettext(self.text.replace('\r\n', '\n'))
#         return ''
# 
#     def date_title_url(self):
#         """Return date+title to include in URL."""
#         text_url = re.sub(' +', '-',
#                           re.sub('[^ a-zA-Z0-9.]', ' ', self.title).strip())
#         return (f'{self.date.year:0>4}{self.date.month:0>2}{self.date.day:0>2}'
#                 f'-{text_url}')


from datetime import datetime
from django.contrib.syndication.views import Feed
from weechat.news.models import Info
                f'{item.id}')

    def item_pubdate(self, info):
        """Return idem date."""
        # pylint: disable=no-self-use
        return info.date


class LatestNewsFeed(WeechatFeed):
    """Feed with latest news."""
    title = 'WeeChat news'
    description = title
    link = '/news/'

    def items(self):
        """Return items with date in the past."""
        # pylint: disable=no-self-use
        return (Info.objects.filter(visible=1)
                .filter(date__lte=datetime.now()).order_by('-date')[:10])


class UpcomingEventsFeed(WeechatFeed):
    """Feed with upcoming events."""
    title = 'Upcoming WeeChat events'
    description = title
    link = '/events/'

    def items(self):
        """Return items with date in the future."""
        # pylint: disable=no-self-use

# Path: weechat/news/models.py
# class Info(models.Model):
#     """A WeeChat info."""
#     visible = models.BooleanField(default=False)
#     date = models.DateTimeField()
#     title = models.CharField(max_length=64)
#     author = models.CharField(max_length=256)
#     mail = models.EmailField(max_length=256)
#     text = models.TextField(blank=True)
# 
#     def __str__(self):
#         return f'{self.title} ({self.date})'
# 
#     def date_l10n(self):
#         """Return the info date formatted with localized date format."""
#         return localdate(self.date)
# 
#     def title_i18n(self):
#         """Return translated title."""
#         match = PATTERN_TITLE_VERSION.match(self.title)
#         if match:
#             # if the title is "Version x.y.z", translate only "Version"
#             return f'{gettext(match.group(1))} {match.group(2)}'
#         return gettext(self.title)
# 
#     def text_i18n(self):
#         """Return translated text."""
#         if self.text:
#             return gettext(self.text.replace('\r\n', '\n'))
#         return ''
# 
#     def date_title_url(self):
#         """Return date+title to include in URL."""
#         text_url = re.sub(' +', '-',
#                           re.sub('[^ a-zA-Z0-9.]', ' ', self.title).strip())
#         return (f'{self.date.year:0>4}{self.date.month:0>2}{self.date.day:0>2}'
#                 f'-{text_url}')


# Path: weechat/news/feeds.py
from datetime import datetime
from django.contrib.syndication.views import Feed
from weechat.news.models import Info

                f'{item.id}')

    def item_pubdate(self, info):
        """Return idem date."""
        # pylint: disable=no-self-use
        return info.date


class LatestNewsFeed(WeechatFeed):
    """Feed with latest news."""
    title = 'WeeChat news'
    description = title
    link = '/news/'

    def items(self):
        """Return items with date in the past."""
        # pylint: disable=no-self-use
        return (Info.objects.filter(visible=1)
                .filter(date__lte=datetime.now()).order_by('-date')[:10])


class UpcomingEventsFeed(WeechatFeed):
    """Feed with upcoming events."""
    title = 'Upcoming WeeChat events'
    description = title
    link = '/events/'

    def items(self):
        """Return items with date in the future."""
        # pylint: disable=no-self-use

        return (Info.objects.filter(visible=1)