You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

13 lines
554 B

  1. from django.apps import apps as django_apps
  2. from django.contrib.sitemaps import Sitemap
  3. from django.core.exceptions import ImproperlyConfigured
  4. class FlatPageSitemap(Sitemap):
  5. def items(self):
  6. if not django_apps.is_installed('django.contrib.sites'):
  7. raise ImproperlyConfigured("FlatPageSitemap requires django.contrib.sites, which isn't installed.")
  8. Site = django_apps.get_model('sites.Site')
  9. current_site = Site.objects.get_current()
  10. return current_site.flatpage_set.filter(registration_required=False)