"""
Sitemap for the announcements app.
"""

from django.contrib.sitemaps import Sitemap

from .models import Announcement


class AnnouncementsSitemap(Sitemap):
    """
    Sitemap for the announcements.
    """

    changefreq = 'daily'
    priority = 0.4

    def items(self):
        """
        Return all the published announcements.
        :return: All the published announcements.
        """
        return Announcement.objects.published()

    def lastmod(self, obj):
        """
        Return the last modification date of the given announcement.
        :param obj: The announcement.
        :return: The last modification date of the given announcement.
        """
        return obj.last_content_modification_date or obj.pub_date

@@ -102,16 +102,17 @@
  import 
+(
 Announce
@@ -115,16 +115,55 @@
 uncement
+,%0A                     AnnouncementTag)
 %0A%0A%0Aclass
@@ -343,20 +343,16 @@
 urn all 
-the 
 publishe
@@ -389,20 +389,16 @@
 rn: All 
-the 
 publishe
@@ -697,32 +697,32 @@
 nt.%0A        %22%22%22%0A
-
         return o
@@ -771,8 +771,320 @@
 ub_date%0A
+%0A%0Aclass AnnouncementTagsSitemap(Sitemap):%0A    %22%22%22%0A    Sitemap for the announcement tags.%0A    %22%22%22%0A%0A    changefreq = 'weekly'%0A    priority = 0.1%0A%0A    def items(self):%0A        %22%22%22%0A        Return all announcement tags.%0A        :return: All announcement tags.%0A        %22%22%22%0A        return AnnouncementTag.objects.all()%0A

Rework sitemaps of the announcements app