forked from 42CTF/website
26 lines
664 B
Python
26 lines
664 B
Python
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}) |