Finished cleaning all the e-cidadania apps
[e_cidadania.git] / src / apps / ecidadania / staticpages / models.py
blob148e7a3fafd3e05241520adac834efc696252d9f
1 # -*- coding: utf-8 -*-
3 # Copyright (c) 2010-2012 Cidadania S. Coop. Galega
5 # This file is part of e-cidadania.
7 # e-cidadania is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # e-cidadania is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with e-cidadania. If not, see <http://www.gnu.org/licenses/>.
20 from django.db import models
21 from django.utils.translation import ugettext_lazy as _
22 from django.conf import settings
23 from django.contrib.auth.models import User, Group
25 class StaticPage(models.Model):
27 """
28 Create basic static pages.
29 """
30 name = models.CharField(_('Page Title'), max_length = 100)
31 uri = models.CharField(_('URL'), max_length = 50)
32 content = models.TextField(_('Content'))
33 show_footer = models.BooleanField(_('Show in footer'))
34 author = models.ForeignKey(User, blank=True, null=True, verbose_name=_('Author'))
35 pub_date = models.DateTimeField(auto_now_add=True)
36 last_update = models.DateTimeField(_('Last update'), auto_now=True)
37 order = models.IntegerField(_('Order'))
39 class Meta:
40 ordering = ['name']
41 verbose_name_plural = _('Static Pages')
43 def __unicode__(self):
44 return self.name
46 @models.permalink
47 def get_absolute_url(self):
48 return ('view-page', (), {
49 'slug': self.uri})