Unverified Commit dd74bfbe authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Include partners in site map

parent f3b5a289
from django.db import models
from django.core.validators import RegexValidator, URLValidator
from django.urls import reverse
from utils.translation import MultilingualField, ModelTranslateMeta
from tinymce.models import HTMLField
......@@ -56,6 +57,9 @@ class Partner(models.Model):
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('partner', args=(self.slug,))
class PartnerImage(models.Model):
partner = models.ForeignKey(
from django.contrib import sitemaps
from django.urls import reverse
from . import models
class StaticViewSitemap(sitemaps.Sitemap):
changefreq = 'daily'
def items(self):
return ['partners:index', 'partners:vacancies']
def location(self, item):
return reverse(item)
class PartnerSitemap(sitemaps.Sitemap):
def items(self):
return models.Partner.objects.filter(is_active=True)
def location(self, item):
return item.get_absolute_url()
sitemap = {
'partners-static': StaticViewSitemap,
'partners-partners': PartnerSitemap,
......@@ -30,6 +30,7 @@ from committees.sitemaps import sitemap as committees_sitemap
from members.sitemaps import sitemap as members_sitemap
from documents.sitemaps import sitemap as documents_sitemap
from thabloid.sitemaps import sitemap as thabloid_sitemap
from partners.sitemaps import sitemap as partners_sitemap
thalia_sitemap = {
'main-static': StaticViewSitemap,
......@@ -38,6 +39,7 @@ thalia_sitemap.update(committees_sitemap)
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment