Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Noticia(models.Model):
- publicado = models.ForeignKey(Perfil, editable = False)
- titulo = models.CharField('Título', max_length = 250, blank = False, null =False)
- cuerpo = models.TextField('Noticia', blank = False, null =False)
- fecha = models.DateField('Fecha de publicación', default = datetime.date.today(), editable = False)
- foto = models.CharField('Thumb', max_length = 250, blank = True, null = True)
- fuente = models.CharField('Fuente', max_length = 20, blank = False, null =False)
- class Meta:
- verbose_name = 'Noticia'
- verbose_name_plural = 'Noticias'
- def __unicode__(self):
- return u'%s' % (self.titulo)
- def get_titulo(self):
- return u'%s' % self.titulo.replace(' ', '_')
- def vista_previa(self):
- if self.foto:
- return '<img src="%s" alt="thumb" heigth="50px" width="50px"/>' % self.foto
- return u''
- vista_previa.allow_tags = True
Advertisement
Add Comment
Please, Sign In to add comment