class News models Model name models CharField Name max_length 100 desc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class News(models.Model):
name = models.CharField(_('Name'), max_length=100)
description = models.TextField(_('Text'))
date = models.DateField(_('Date'))
picture = models.ImageField(
_("Picture"),
upload_to=lambda instance, filename: "images/news/%s/%s" % (instance.pk, filename),
max_length=255
)
def __unicode__(self):
return self.name