1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.db import models
5 from django.urls import reverse
6 from django.utils.translation import gettext_lazy as _
9 class InfoPage(models.Model):
10 """An InfoPage is used to display a two-column flatpage."""
12 main_page = models.IntegerField(_('main page priority'), null=True, blank=True)
13 slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True)
14 title = models.CharField(_('title'), max_length=120, blank=True)
15 left_column = models.TextField(_('left column'), blank=True)
16 right_column = models.TextField(_('right column'), blank=True)
19 ordering = ('main_page', 'slug',)
20 verbose_name = _('info page')
21 verbose_name_plural = _('info pages')
26 def get_absolute_url(self):
27 return reverse('infopage', args=[self.slug])