from django.contrib import sitemaps from django.urls import reverse from .models import Category, CTF from .views import category, ctf class CategorySitemap(sitemaps.Sitemap): changefreq = "weekly" priority = 0.7 i18n = True def items(self): return Category.objects.all() def location(self, obj): return reverse(category, kwargs={'cat_slug': obj.slug}) class CTFSitemap(sitemaps.Sitemap): changefreq = "weekly" priority = 0.7 i18n = True def items(self): return CTF.objects.all() def location(self, obj): return reverse(ctf, kwargs={'cat_slug': obj.category.slug, 'ctf_slug': obj.slug})