1 # -*- coding: utf8; -*-
3 Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
20 from django.db import models
21 from django.contrib.auth.models import User
25 class Noticia(models.Model):
26 titulo = models.CharField(maxlength=100)
27 autor = models.ForeignKey(User)
28 data_criacao = models.DateTimeField(auto_now=True)
29 chamada = models.TextField(help_text='Texto que irá aparecer na index.')
30 corpo = models.TextField(help_text='Texto que irá aparecer na '
31 'página de detalhes da notícia.')
34 js = ('/site_media/tiny_mce/tiny_mce.js',
35 '/site_media/js/textarea-noticias.js',)
39 return '%s - %s' % (self.titulo, self.data_criacao)
42 if len(self.corpo) > ELLIPSIS_START:
43 return self.corpo[:ELLIPSIS_START] + ' ...'
47 class Secao(models.Model):
48 nome = models.CharField(maxlength=100)
49 corpo = models.TextField()
52 verbose_name = 'seção'
53 verbose_name_plural = 'seções'
62 class Menu(models.Model):
63 titulo = models.CharField(maxlength=100)
64 secao = models.ForeignKey(Secao)