# Path: statirator/pages/models.py
# class Page(models.Model, TranslationsMixin):
#     """A multilingual page"""
# 
#     title = models.CharField(max_length=200)
#     slug = models.SlugField(max_length=200)
#     content = models.TextField()
#     language = models.CharField(max_length=5, choices=settings.LANGUAGES,
#                                 blank=True, default=settings.LANGUAGE_CODE)
#     page_type = models.CharField(max_length=5, choices=PAGE_TYPES)
#     description = models.CharField(max_length=255, blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.title or self.slug
# 
#     @i18n_permalink
#     def get_absolute_url(self):
#         # index is a special case
#         if self.slug == 'index':
#             return ('pages_index', (), {})
# 
#         return ('pages_page', (), {'slug': self.slug})


from django.contrib.sitemaps import Sitemap
from django.conf import settings
from .models import Page
from __future__ import absolute_import




class PagesSiteMap(Sitemap):

    def items(self):
        "Return the items starting with defualt language and it's index page"

        default = settings.LANGUAGE_CODE
        langs = [default] + [x[0] for x in settings.LANGUAGES if x[0] != default]

        items = []
        for lang in langs:

# Path: statirator/pages/models.py
# class Page(models.Model, TranslationsMixin):
#     """A multilingual page"""
# 
#     title = models.CharField(max_length=200)
#     slug = models.SlugField(max_length=200)
#     content = models.TextField()
#     language = models.CharField(max_length=5, choices=settings.LANGUAGES,
#                                 blank=True, default=settings.LANGUAGE_CODE)
#     page_type = models.CharField(max_length=5, choices=PAGE_TYPES)
#     description = models.CharField(max_length=255, blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.title or self.slug
# 
#     @i18n_permalink
#     def get_absolute_url(self):
#         # index is a special case
#         if self.slug == 'index':
#             return ('pages_index', (), {})
# 
#         return ('pages_page', (), {'slug': self.slug})


# Path: statirator/pages/sitemap.py
from django.contrib.sitemaps import Sitemap
from django.conf import settings
from .models import Page

from __future__ import absolute_import




class PagesSiteMap(Sitemap):

    def items(self):
        "Return the items starting with defualt language and it's index page"

        default = settings.LANGUAGE_CODE
        langs = [default] + [x[0] for x in settings.LANGUAGES if x[0] != default]

        items = []
        for lang in langs:

            idx = Page.objects.get(slug='index', language=lang)