gremmie@1: """ gremmie@1: Models for the shoutbox application. gremmie@1: """ gremmie@1: from django.db import models gremmie@1: from django.contrib.auth.models import User gremmie@1: gremmie@1: class Shout(models.Model): gremmie@1: user = models.ForeignKey(User) gremmie@1: shout_date = models.DateTimeField(auto_now_add=True) gremmie@1: shout = models.TextField() gremmie@1: gremmie@1: def __unicode__(self): gremmie@1: shout = self.shout[:60] gremmie@1: return u'Shout from %s: %s' % (self.user.username, shout) gremmie@1: gremmie@1: class Meta: gremmie@1: ordering = ('-shout_date', )