Paste #76

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# myapp/models.py

class ThumbnailType(db.Model):
    created = db.DateTimeProperty(auto_now_add=True)
    updated = db.DateTimeProperty(auto_now=True)
    # Only one of width and height can be set.
    width = db.IntegerProperty(default=0)
    height = db.IntegerProperty(default=0)
    format = db.StringProperty(choices=image_formats)
    is_active = db.BooleanProperty(default=False)
    def __unicode__(self):
        return '%s | %s | %s' % (
                                 self.format.upper(),
                                 self.width and 'WIDTH: %s' % self.width or 'HEIGHT: %s' % self.height,
                                 self.is_active and 'ACTIVE' or 'INACTIVE',
                                 )