예제 #1
0
def discover_sitemaps():
    from django.contrib.sites.models import Site
    from navigation.models import Sitemap
    
    for info in get_sitemap_info_list():
        if Sitemap.current_objects.filter(slug=info.slug).count() == 0:
            sitemap = Sitemap()
            sitemap.site = Site.objects.get_current()
            sitemap.slug = info.slug
            sitemap.save()
예제 #2
0
def discover_sitemaps():
    from django.contrib.sites.models import Site
    from navigation.models import Sitemap

    for info in get_sitemap_info_list():
        if Sitemap.current_objects.filter(slug=info.slug).count() == 0:
            sitemap = Sitemap()
            sitemap.site = Site.objects.get_current()
            sitemap.slug = info.slug
            sitemap.save()
예제 #3
0
 def refresh_current_site(self):
     from navigation.models import Sitemap
     
     site = Site.objects.get_current()
     for sitemap_info in get_sitemap_info_list():
         try:
             sitemap = Sitemap.objects.filter(site=site, slug=sitemap_info.slug).get()
         except ObjectDoesNotExist:
             sitemap = Sitemap()
             sitemap.site = site
             
         sitemap.slug = sitemap_info.slug
         sitemap.save()
         sitemap.refresh()
     pass