from django.contrib.syndication.views import Feed
from django.conf import settings
from geodata.models import EarthGeoDataPatrimony, EarthGeoDataConstruction,\
    EarthGeoDataMeeting


class PatrimonyFeed(Feed):
    """A feed presenting changes and additions on EarthGeoDataPatrimony."""
    title = settings.SITE_NAME + " patrimony news."
    link = "/"
    description = "Updates on changes and additions to patrimonies of " + settings.SITE_NAME + "."

    def items(self):
        return EarthGeoDataPatrimony.objects.order_by('-pub_date')[:20]

    def item_title(self, item):
        return item.name

    def item_description(self, item):
        return item.description


class ConstructionFeed(Feed):
    """A feed presenting changes and additions on EarthGeoDataConstruction."""
    title = settings.SITE_NAME + " construction news."
    link = "/"
    description = "Updates on changes and additions to patrimonies of " + settings.SITE_NAME + "."

    def items(self):
        return EarthGeoDataConstruction.objects.order_by('-pub_date')[:20]

    def item_title(self, item):
        return item.name

    def item_description(self, item):
        return item.description


class MeetingFeed(Feed):
    """A feed presenting changes and additions on EarthGeoDataMeeting."""
    title = settings.SITE_NAME + " meeting news."
    link = "/"
    description = "Updates on changes and additions to patrimonies of " + settings.SITE_NAME + "."

    def items(self):
        return EarthGeoDataMeeting.objects.order_by('-pub_date')[:20]

    def item_title(self, item):
        return item.name

    def item_description(self, item):
        return item.description



@@ -1,20 +1,21 @@
+#
 from django.contrib.
@@ -44,16 +44,213 @@
 rt Feed%0A
+from django.contrib.syndication.views import Feed%0Afrom django.contrib.gis.feeds import GeoRSSFeed%0Afrom django.utils.translation import ugettext_lazy as _%0A#from django.contrib.gis.feeds import Feed%0A
 from dja
@@ -557,32 +557,34 @@
   description = 
+_(
 %22Updates on chan
@@ -639,32 +639,223 @@
 .SITE_NAME + %22.%22
+)%0A%0A    feed_type = GeoRSSFeed%0A%0A    #def item_extra_kwargs(self, item):%0A    #    return %7B'geometry' : self.item_geometry(item)%7D%0A%0A    def item_geometry(self, item):%0A        return item.geometry
 %0A%0A    def items(
@@ -1177,32 +1177,34 @@
 %22%22%22%0A    title = 
+_(
 settings.SITE_NA
@@ -1225,24 +1225,25 @@
 ction news.%22
+)
 %0A    link = 
@@ -1256,32 +1256,34 @@
   description = 
+_(
 %22Updates on chan
@@ -1299,34 +1299,36 @@
 dditions to 
-patrimonie
+construction
 s of %22 + set
@@ -1340,32 +1340,223 @@
 .SITE_NAME + %22.%22
+)%0A%0A    feed_type = GeoRSSFeed%0A%0A    #def item_extra_kwargs(self, item):%0A    #    return %7B'geometry' : self.item_geometry(item)%7D%0A%0A    def item_geometry(self, item):%0A        return item.geometry
 %0A%0A    def items(
@@ -1871,32 +1871,34 @@
 %22%22%22%0A    title = 
+_(
 settings.SITE_NA
@@ -1914,24 +1914,25 @@
 eting news.%22
+)
 %0A    link = 
@@ -1953,16 +1953,18 @@
 ption = 
+_(
 %22Updates
@@ -1988,34 +1988,31 @@
 dditions to 
-patrimonie
+meeting
 s of %22 + set
@@ -2032,16 +2032,207 @@
 ME + %22.%22
+)%0A%0A    feed_type = GeoRSSFeed%0A%0A    #def item_extra_kwargs(self, item):%0A    #    return %7B'geometry' : self.item_geometry(item)%7D%0A%0A    def item_geometry(self, item):%0A        return item.geometry
 %0A%0A    de

transform rss feeds to georss feeds