--- /dev/null
+# -*- coding: utf8; -*-
+"""
+Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this program; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+"""
+from django.db import models
+from django.contrib.auth.models import User
+
+ELLIPSIS_START = 400
+
+class Noticia(models.Model):
+ titulo = models.CharField(maxlength=100)
+ autor = models.ForeignKey(User)
+ data_criacao = models.DateTimeField(auto_now=True)
+ chamada = models.CharField(maxlength=400,
+ help_text='Texto que irá aparecer na index.')
+ corpo = models.TextField(help_text='Texto que irá aparecer na '
+ 'página de detalhes da notícia.')
+
+ class Admin:
+ js = ('/site_media/tiny_mce/tiny_mce.js',
+ '/site_media/js/textarea.js',)
+
+
+ def __str__(self):
+ return '%s - %s' % (self.titulo, self.data_criacao)
+
+ def elipse(self):
+ if len(self.corpo) > ELLIPSIS_START:
+ return self.corpo[:ELLIPSIS_START] + ' ...'
+ else:
+ return self.corpo
+
+class Secao(models.Model):
+ nome = models.CharField(maxlength=100)
+ corpo = models.TextField()
+
+ class Meta:
+ verbose_name = 'seção'
+ verbose_name_plural = 'seções'
+
+ class Admin:
+ pass
+
+ def __str__(self):
+ return self.nome
+
+
+class Menu(models.Model):
+ titulo = models.CharField(maxlength=100)
+ secao = models.ForeignKey(Secao)
+
+ class Admin:
+ pass
+
+ def __str__(self):
+ return self.titulo