Fundraising in PDF.
[wolnelektury.git] / src / infopages / models.py
1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
3 #
4 from django.db import models
5 from django.urls import reverse
6
7
8 class InfoPage(models.Model):
9     """An InfoPage is used to display a two-column flatpage."""
10
11     slug = models.SlugField('slug', max_length=120, unique=True, db_index=True)
12     title = models.CharField('tytuł', max_length=120, blank=True)
13     published = models.BooleanField(
14         'opublikowana',
15         help_text='Nieopublikowane strony są widoczne tylko dla administratorów.'
16     )
17     findable = models.BooleanField('wyszukiwalna')
18     left_column = models.TextField('lewa kolumna', blank=True)
19     right_column = models.TextField('prawa kolumna', blank=True)
20
21     class Meta:
22         verbose_name = 'strona informacyjna'
23         verbose_name_plural = 'strony informacyjne'
24
25     def __str__(self):
26         return self.title
27
28     def get_absolute_url(self):
29         return reverse('infopage', args=[self.slug])